VB Code:
Protected Overrides Sub OnPaint(ByVal e As _ System.Windows.Forms.PaintEventArgs) 'Device Context Dim dc As Graphics = e.Graphics 'The string we are going to write Dim drawString As String = "Pirate" 'Font we'll use Dim drawFont As New Font("Arial", 20, FontStyle.Bold) 'Brush used to write the text supported with 'different colors Dim myBrush As New Drawing2D.LinearGradientBrush(ClientRectangle, _ Color.Yellow, Color.Blue, Drawing2D.LinearGradientMode.Horizontal) 'Check FormatFlags Enums to see different drawing styles 'you can use. Dim drawFormat As New StringFormat() drawFormat.FormatFlags = StringFormatFlags.NoFontFallback 'this explain itself Dim x As Integer = 150 Dim y As Integer = 50 'Finally we apply the Drwaing on the form . dc.DrawString(drawString, drawFont, myBrush, _ x, y, drawFormat) 'Enjoy End Sub





Reply With Quote