tags:

views:

132

answers:

2
+6  A: 

To override the drawing of the control, you must set the style to be UserPaint like this:

this.SetStyle(ControlStyles.UserPaint, true);

See this for more information:

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.setstyle.aspx

UserPaint If true, the control paints itself rather than the operating system doing so. If false, the Paint event is not raised. This style only applies to classes derived from Control.

SLC
Thanks a lot, SLC! I'm making this the accepted answer.
A: 
internal class MyTextBox : System.Windows.Forms.TextBox
{
    public MyTextBox()
    {
        this.SetStyle(ControlStyles.UserPaint, true);
    }

    protected override void OnPaint(PaintEventArgs e)
    {
        base.OnPaint(e);
    }
}
Victor Hurdugaci