Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleLet the user move a form without a title bar
Keywordsmove form, no title bar, drag form
CategoriesControls, API
 
Place a PictureBox (or other things for the user to grab) on the form. In the control's MouseDown event handler, use the ReleaseCapture API function to cancel the mouse event. Then 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 Picture1_MouseDown(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    ReleaseCapture
    SendMessage hwnd, WM_NCLBUTTONDOWN, _
        HTCAPTION, 0&
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated