Public Class Form1
Private b1 As Bitmap
Private g1 As Graphics
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles
MyBase.Activated
Static done As Boolean = False
If Not done Then
Size = New Size(300, 350)
Text = "Print 1 - 10"
b1 = New Bitmap(Width, Height, Me.CreateGraphics())
g1 = Graphics.FromImage(b1)
done = True
FormPrint("Print number from 1 - 10", 25, 10)
FormPrint("1", 25, 25)
FormPrint("2", 25, 40)
FormPrint("3", 25, 55)
FormPrint("4", 25, 70)
FormPrint("5", 25, 85)
FormPrint("6", 25, 100)
FormPrint("7", 25, 115)
FormPrint("8", 25, 130)
FormPrint("9", 25, 145)
FormPrint("10", 25, 160)
End If
End Sub
Private Sub FormPrint(ByVal t$, ByVal x1%, ByVal y1%)
g1.DrawString(t, New Font("Comic Sans MS", 12), Brushes.Chocolate, x1, y1)
Me.CreateGraphics.DrawImage(b1, 0, 0)
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles
MyBase.Paint
e.Graphics.DrawImage(b1, 0, 0)
End Sub
End Class