ok, I know what picture.drag 1 and picture.drag 2 is, but how do I conbine them to make a drag and drop thing? all I want to be able to do is drag a picturebox around the place, but how?
Printable View
ok, I know what picture.drag 1 and picture.drag 2 is, but how do I conbine them to make a drag and drop thing? all I want to be able to do is drag a picturebox around the place, but how?
The following should work fine ;)
Code:Option Explicit
Public bPressed As Boolean
Public iX As Long
Public iY As Long
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
bPressed = True
iX = X
iY = Y
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If bPressed = True Then
Picture1.Left = Picture1.Left + X - iX
Picture1.Top = Picture1.Top + Y - iY
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
bPressed = False
End Sub