This is a simple example to give you some explaination on using GDI+ to draw text
VB Code:
'The Paint event is used to ensure that the drawing is done verytime the control 'requires a repaint (like moving, resizing...) Private Sub Form1_Paint(ByVal sender As Object, _ ByVal e As System.Windows.Forms.PaintEventArgs) _ Handles Me.Paint 'Delclare a font Dim fntName As String = "Times New Roman" Dim fntSize As Single = 14 Dim fntStyle As FontStyle = FontStyle.Bold Dim fnt As New Font(fntName, fntSize, fntStyle) 'Declare a brush Dim brsh As Brush = Brushes.DarkGreen 'Declare a location to start the drawing Dim loc As Point = New Point(50, 50) 'Now you're redy to draw using DrawString. To draw on something, you need to 'use the graphics object of that thing. This example draws the text on the for, 'so I get the graphics object of the form by calling Me.CreateGraphics Dim g As Graphics = Me.CreateGraphics g.DrawString("This is a line", fnt, brsh, loc) End Sub




Reply With Quote