Click here to Skip to main content
15,886,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Thanks in advance!!!...I am using Curved Textbox for Username and Password..It is good for username but Password I need to show as * format....In this textbox property doesnot contain Passwordchar at all....Pls help...

What I have tried:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RoundTextBox
{
    internal class MyRectangle
    {
        private Point Location;
        private float radius;
        private GraphicsPath gtpath;
        private float x;
        private float y;
        private float width;
        private float height;

        public MyRectangle() { }
        public MyRectangle(float width,float height,float radius,float x=0f,float y=0f)
        {
            this.Location = new Point(0, 0);
            this.radius = radius;
            this.x = x;
            this.y = y;
            this.height = height;
            this.width = width;
            this.gtpath = new GraphicsPath();
            if(radius<=0f)
            {
                this.gtpath.AddRectangle(new RectangleF(x, y, width, height));

            }
            else
            {
                RectangleF ef = new RectangleF(x, y, 2f * radius, 2f * radius);
                RectangleF ef2 = new RectangleF((width - (2f * radius))-1f ,x, 2f * radius, 2f * radius);
                RectangleF ef3 = new RectangleF(x, (height - (2f * radius)) - 1f, 2f * radius, 2f * radius);
                RectangleF ef4 = new RectangleF((width - (2f * radius)) - 1f, (height - (2f * radius)) - 1f, 2f * radius, 2f * radius);

                this.gtpath.AddArc(ef, 180f, 90f);
                this.gtpath.AddArc(ef2, 270f, 90f);
                this.gtpath.AddArc(ef4, 0f, 90f);
                this.gtpath.AddArc(ef3, 90f, 90f);
                this.gtpath.CloseAllFigures();


            }

        }

       public GraphicsPath path =>
            this.gtpath;
        public RectangleF rect =>
            new RectangleF(this.x, this.y, this.width, this.height);
        public float Radius
        {
            get => this.radius;
            set =>
                this.radius = value;

        }
    }
}
Posted
Updated 5-Feb-21 22:36pm

1 solution

Your Rectangle class should inherit TextBox. That way you will have access to all of the TextBox class's Properties and Methods.
 
Share this answer
 
Comments
Member 15028582 6-Feb-21 7:49am    
Actually I am new to C#.net...Can you explain Clearly ji...Pls
Richard MacCutchan 6-Feb-21 8:08am    
You need to use the TextBox as the base for creating your own custom control. Detailed information can be found at Develop Custom Controls - Windows Forms .NET Framework | Microsoft Docs[^].
Member 15028582 6-Feb-21 9:24am    
Thanks ji...I got the output :)....Thanks for the help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900