Results 1 to 3 of 3

Thread: [RESOLVED] move a form with no borders

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Resolved [RESOLVED] move a form with no borders

    i want to make my form have no borders(borderstyle = none) and i want it moveable.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: move a form with no borders

    Few api calls are needed:
    Code:
    Option Explicit
    
    Private Const WM_NCLBUTTONDOWN = &HA1
    Private Const HTCAPTION = 2
    
    Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" _
        (ByVal hwnd As Long, ByVal wMsg As Long, _
         ByVal wParam As Long, ByVal lParam As Long) As Long
    
    Private Declare Function ReleaseCapture Lib "user32" () As Long
    
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = vbLeftButton Then
            ReleaseCapture
            SendMessageLong Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
        End If
    End Sub

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: move a form with no borders

    thank you, it works perfectly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width