You need to try out something like this.
Add a new user control , say CustomTextBox and change
public partial class CustomTextBox : UserControl
to
public partial class CustomTextBox : TextBox
You will then get the following error saying that the ‘AutoScaleMode’ is not defined. Delete the following line in the Designer.cs class.
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
Make changes to the constructor of your newly added control as follows.
public partial class CustomTextBox : TextBox
{
public CustomTextBox()
{
InitializeComponent();
SetStyle(ControlStyles.SupportsTransparentBackColor |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.ResizeRedraw |
ControlStyles.UserPaint, true);
BackColor = Color.Transparent;
}
}
Build, close the custom control designer if open and you will be able to use this control on any other control or form.