[RESOLVED] How to move a frame like a form in run time with mouse click and drag?
Hi,
How to move a frame like a form in run time with mouse click and drag?
I tried the following coding but it is not working? Any idea?
In module,
VB Code:
Public Type Position
X As Single
Y As Single
End Type
In form,
VB Code:
Dim Clicked As Position
Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Clicked.X = X
Clicked.Y = Y
End Sub
Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Clicked.X <> 0 Or Clicked.Y <> 0 Then
Frame1.Left = Frame1.Left + (X - Clicked.X)
Frame1.Top = Frame1.Top + (Y - Clicked.Y)
Clicked.X = X
Clicked.Y = Y
End If
End Sub
Re: How to move a frame like a form in run time with mouse click and drag?
You need to initialize and then end the dragging.
There are tons of samples posted.
Here is just one of them:
http://www.vbforums.com/showthread.php?t=437552
Re: How to move a frame like a form in run time with mouse click and drag?
Re: [RESOLVED] How to move a frame like a form in run time with mouse click and drag?
Hi,
instead of Frame1_MouseMove you should use Frame1_MouseUp event
thanks
Re: [RESOLVED] How to move a frame like a form in run time with mouse click and drag?
This thread is nine years old. The people have likely moved on to new things. Therefore, I closed it.