Dim dragabled As Boolean, oldx As Single, oldy As Single
Private Sub cmdDrag_Click()
dragabled = Not dragabled
cmdDrag.Caption = IIf(dragabled, "cmdDrag disabled", "cmdDrag enabled")
End Sub
Private Sub Form_Load()
cmdDrag.Caption = "cmdDrag enabled"
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If dragabled Then
oldx = X + Left
oldy = Y + Top
Image1.Drag 1
End If
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If dragabled Then Image1.Drag 2
End Sub
Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move Left + X - oldx, Top + Y - oldy
End Sub