Hello, You can try the given code. BEGIN CODE Dim MD, MU As Point Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown MD = e.Location End Sub Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove If e.Button = Windows.Forms.MouseButtons.Left Then MU = e.Location DrawLine() End If End Sub Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp MU = e.Location DrawLine() End Sub Public Sub DrawLine() Dim g As Graphics g = Me.PictureBox1.CreateGraphics g.Clear(Me.PictureBox1.BackColor) g.DrawLine(Pens.Blue, MD, MU) g.Dispose() End Sub
I hope this will help. Regards,
Allen Smith ComponentOne LLC www.componentone.com