Good morning. I want to share this simple code. It allows the user to move the window, by clicking and dragging, from any point on the Form.
The scrolling achieved is smooth and pleasant, just as if the click had been on the title bar.
With almost no code, it provides elegant functionality.
Also useful when the Window Title Bar is higher up the screen. In this case, the Form can be downloaded by fishing it from any point on it.
You can also make the call from the MouseMove Event of a Control Frame. In this case, clicking on it and dragging moves the Form.
You could even put it in the MouseMove Event of any particular control, achieving the same effect, moving the form to any part of the screen. [/B]
Please, if you implemented it, comment if you liked it or not. This is a translation from Spanish, sorry if the reading is not pleasant. Thank you
.
In each Form to move:
Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
In a module:
Static Sub FormMove(Formulario As Form, Button As Integer, X As Single, Y As Single)
The scrolling achieved is smooth and pleasant, just as if the click had been on the title bar.
With almost no code, it provides elegant functionality.
Also useful when the Window Title Bar is higher up the screen. In this case, the Form can be downloaded by fishing it from any point on it.
You can also make the call from the MouseMove Event of a Control Frame. In this case, clicking on it and dragging moves the Form.
You could even put it in the MouseMove Event of any particular control, achieving the same effect, moving the form to any part of the screen. [/B]
Please, if you implemented it, comment if you liked it or not. This is a translation from Spanish, sorry if the reading is not pleasant. Thank you
.
In each Form to move:
Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FormMove Me, Button, X, Y
End SubIn a module:
Static Sub FormMove(Formulario As Form, Button As Integer, X As Single, Y As Single)
Dim MemX As Single, MemY As Single, YaMovio As Boolean, AchFrm As Single
AchFrm = Formulario.Width
If Button = 1 Then
If Not YaMovio Then YaMovio = True: MemX = X: MemY = Y
Formulario.Left = Formulario.Left + X - MemX
Formulario.Top = Formulario.Top + Y - MemY
Else
YaMovio = False
End If
End Sub