-
I'm having a problem with the following code and I need a tip or workaround:
Dim OldX As Single
Dim OldY As Single
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Left = X - OldX
Source.Top = Y - OldY
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
OldX = X
OldY = Y
Picture1.Drag
End If
The problem is the x,y of the form is not realized unless the cursor leaves the original plane of the picturebox. In other words if you put the cursor in the middle of a picbox that is 1000 whatevers wide by 1000 whatevers high you can't move the picture box 499 or less whatevers. Any help?
Thanks,
Joey O
-
Try:
Code:
Dim OldX As Single
Dim OldY As Single
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
OldX = X
OldY = Y
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then Picture1.Move Picture1.Left + (X - OldX), Picture1.Top + (Y - OldY)
End Sub
-
Aeron
Aaron,
As always, you amaze me. Thanks again.
JoeyO