Article ID: 103062
Article Last Modified on 12/9/2003
Dim Save_X As Single Dim Save_Y As Single ' Enter the following Sub as one, single line: Sub Picture1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single) Save_X = X ' save mouse position (relative to this control) Save_Y = Y Picture1.Drag 1 ' begin dragging End Sub ' Enter the following Sub as one, single line: Sub Picture1_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single) Picture1.Drag 2 ' end dragging, do DragDrop event End Sub Sub Form_DragDrop (Source As Control, X As Single, Y As Single) ' Move the control to the position of the mouse pointer. ' Adjust it by the distance the mouse pointer to the upper ' left corner of the control. Source.Move X - Save_X, Y - Save_Y End Sub Sub Picture1_DragDrop (Source As Control, X As Single, Y As Single) ' This handles the case when the control is dropped on itself ' as would happen if it was only moved a small amount. ' This is similar to Form_DragDrop except that the X and Y ' parameters are relative to this control, not the form. Source.Move Picture1.Left + X - Save_X, Picture1.Top + Y - Save_Y End Sub
Additional query words: 1.00 2.00 3.00 runtime run-time
Keywords: KB103062