Drawing on mouse move in a picture box in vb6 - TechRepublic
Question
July 7, 2008 at 08:50 AM
pkhorraminejad

Drawing on mouse move in a picture box in vb6

by pkhorraminejad . Updated 17 years, 11 months ago

Hi
I’m trying to create a form that has a picturebox which I want the user to be able to sign their name in it. I have the following code but it just allows me to draw straight lines. Please help me.
Thanks

Dim X1 As Integer, Y1 As Integer, X2 As Integer, Y2 As Integer
Dim oldX As Integer, oldY As Integer
Private Sub Form_Load()
X1 = 0: Y1 = 0: oldX = 0: oldY = 0
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

X1 = X
Y1 = Y

End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbLeftButton Then
X2 = X
Y2 = Y
picture1.Line (X1, Y1)-(oldX, oldY) Picture1.Line (X1, Y1)-(X2, Y2)
oldX = X2: oldY = Y2

End If

End Sub

This discussion is locked

All Comments