Question

Locked

Drawing on mouse move in a picture box in vb6

By pkhorraminejad ·
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 conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Peripheral Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums