Decorating a text box will be easy with Graphic class in C#.net . Suppose you wanna create a custom control and like to draw a custom Line , all you need to do is override the paint method and add the following code.
private Color borderColor = Color.Salmon;
private int borderSize = 2;
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics graph = e.Graphics;
//Draw border
using (Pen penBorder = new Pen(borderColor, borderSize))
{
penBorder.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset;
graph.DrawLine(penBorder, 0, this.Height - 1, this.Width, this.Height - 1);
}
}
I hope the code snippet helps you and the following will also do the same
- Connection string for MSQL Server local database
- Quilljs mention snippet
- Categorize user control properties in C#
- Add properties to user control in C#
- How to update Listview from Background Worker in WinForm-C#.Net ?
- How to draw a line below textbox using Pen in C#
- How to draw a rectangle around textbox in C#
- Python : list to tuple
- Flutter Search Widget
- Sliding Login/Signup form in React