Move a form without a title bar.
Move a form without a title bar.
API Declarations
I see many requests for people wanting to know how to move a form either when the title bar is not visible or without using the title bar. All it takes is two API declarations, two constants, and two lines of code.
Insert this code in a module:
Rate Move a form without a title bar.
(1(1 Vote))
Lib "user32" () As Long
Declare Function SendMessage Lib _
"user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Public Const HTCAPTION = 2
Public Const WM_NCLBUTTONDOWN = &HA1
'--end code block
Place this code in the MouseDown event in the Form, PictureBox, etc:
ReleaseCapture
SendMessage hwnd, _
WM_NCLBUTTONDOWN, _
HTCAPTION, 0&
'--end code block
Thats all there is to it.
Move a form without a title bar. Comments
No comments yet — be the first to post one!
Post a Comment