Public Class Form1 Private bmp As Bitmap = Nothing Private sP, ep As Point Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load bmp = New Bitmap(PictureBox1.ClientRectangle.Width, PictureBox1.ClientRectangle.Height) PictureBox1.Image = bmp End Sub Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown If e.Button = Windows.Forms.MouseButtons.Left Then sP = e.Location End If End Sub Private Sub PictureBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove If e.Button = Windows.Forms.MouseButtons.Left Then eP = e.Location PictureBox1.Invalidate() End If End Sub Private Sub PictureBox1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp If e.Button = Windows.Forms.MouseButtons.Left Then ep = e.Location Using g As Graphics = Graphics.FromImage(bmp) g.DrawLine(Pens.Blue, sP, ep) End Using End If End Sub Private Sub PictureBox1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint e.Graphics.DrawLine(Pens.Blue, sP, ep) End Sub End Class