Hi there!
I have a kind of tricky problem (or I'm simply to dumb)
I want to move a control around my form. To put my Button
on the right place after the drop I save the mouse-offset.If for example I start the Drag in the lower right corner ofCode:Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If (Button = vbLeftButton) Then m_sX = X m_sY = Y Command1.Drag vbBeginDrag End If End Sub
the MousePointer stays in the same relative position to the
Drag-Rectangle when I move around the Form.
So far so good.
However sometimes the MousePointer moves to the center of the Drag-Rectangle after the BeginDrag
(about once in 15 attempts). In this case my DragDrop function doesn't put the Button in the right place.
This is not good.Thanks in advance for any advice.Code:Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single) With Source .Left = X - m_sX .Top = Y - m_sY End With End Sub
best regards
da_bob
____________________




)
Reply With Quote