VB.NET sample.
Override the OnPaint event of the TextBox. For example:
protected override void OnPaint(PaintEventArgs e)
{
SolidBrush drawBrush = new SolidBrush( ForeColor ); //Use the ForeColor property
// Draw string to screen.
e.Graphics.DrawString( Text, Font, drawBrush, 0f, 0f ); //Use the Font property
}
Note: You need to set the ControlStyles to "UserPaint" in the constructor.
public MyTextBox()
{
// This call is required by the Windows.Forms Form Designer.
SetStyle( ControlStyles.UserPaint, true );
InitializeComponent();
}
Felix Wu