VB Code:
  1. Protected Overrides Sub OnPaint(ByVal e As _
  2. System.Windows.Forms.PaintEventArgs)
  3.         'Device Context
  4.         Dim dc As Graphics = e.Graphics
  5.  
  6.         'The string we are going to write
  7.         Dim drawString As String = "Pirate"
  8.  
  9.         'Font we'll use
  10.         Dim drawFont As New Font("Arial", 20, FontStyle.Bold)
  11.  
  12.         'Brush used to write the text supported with
  13.         'different colors
  14.         Dim myBrush As New Drawing2D.LinearGradientBrush(ClientRectangle, _
  15.         Color.Yellow, Color.Blue, Drawing2D.LinearGradientMode.Horizontal)
  16.  
  17.         'Check FormatFlags Enums to see different drawing styles
  18.         'you can use.
  19.         Dim drawFormat As New StringFormat()
  20.         drawFormat.FormatFlags = StringFormatFlags.NoFontFallback
  21.  
  22.         'this explain itself
  23.         Dim x As Integer = 150
  24.         Dim y As Integer = 50
  25.  
  26.         'Finally we apply the Drwaing on the form .
  27.         dc.DrawString(drawString, drawFont, myBrush, _
  28.         x, y, drawFormat)
  29.         'Enjoy
  30.     End Sub