Public Class Form1
Inherits System.Windows.Forms.Form
Public GDIBM As IntPtr
Public GrafMem As Graphics
Public BM As Bitmap
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
GDIBM = CreateCompatibleBitmap(GetDC(PictureBox1.Handle), 100, 100)
BM = Image.FromHbitmap(GDIBM)
GrafMem = System.Drawing.Graphics.FromImage(BM)
PictureBox1.Image = BM
Рисуем()
End Sub
Public Sub Рисуем()
Dim myFont As New Font("arial", 20)
GrafMem.Clear(Color.White)
GrafMem.DrawLine(Pens.Blue, 10, 10, 100, 10)
GrafMem.DrawRectangle(Pens.Red, 1, 1, 50, 50)
GrafMem.DrawString("Hello", myFont, Brushes.Black, 20, 20)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
GrafMem.FillRectangle(Brushes.Black, 50, 50, 20, 20)
PictureBox1.Refresh()
End Sub
Попробуйте! :D [/img]