|
|
Title | Let the user move a 1-pixel wide form without a title bar |
Keywords | move form, no title bar, drag form |
Categories | Controls, API |
|
|
Set the form's KeyPreview property to True. In the KeyDown event handler, look for the Control-M combination.
When you see it, send the form the
WM_NCLBUTTONDOWN message with the HTCAPTION parameter. This tells the form that the user has pressed
the mouse down on its title bar and that starts moving the form.
|
|
Private Sub Form_KeyDown(KeyCode As Integer, Shift As _
Integer)
' See if this is Control-M.
If (Shift = vbCtrlMask) And (KeyCode = vbKeyM) Then
SendMessage hwnd, WM_NCLBUTTONDOWN, _
HTCAPTION, 0&
End If
End Sub
|
|
One catch: After you move the form, you need to click on it before you can move it again for some reason.
Let me know if you figure out how to solve that little problem.
|
|
|
|
|
|