Form Title Bar

RevJeff

Registered User.
Local time
Today, 01:35
Joined
Sep 18, 2002
Messages
127
Hello all,

Is there a way of removing the top menu bar of a popup form? I know I could set the border to none, but I still want the thin border all around the form, just not the top title bar.

Thank you
 
Set the border to none and put a rectangle around the whole form.
 
Thank you for the thought, but the problem with that solution is that the form is stuck in one position and can't be moved around.
 
If you have a standard pop-up form you have to grab the top bar to move it so if there is no top bar it cannot be moved.

I suspect you are out of luck
 
you could put a 'move' label or image control on your form, then use code along these lines

Code:
Option Compare Database
Option Explicit
  
Dim msedown As Boolean

  
Private Sub movelbl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  
    msedown = True
  
End Sub
  
Private Sub movelbl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  
     If msedown Then Me.Move Me.Move WindowLeft + X, WindowTop + Y

 End Sub
  
Private Sub movelbl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  
     msedown = False

End Sub
 
here, put in a module.
now make your form without border or titlebar.
you call the function in the MouseDown event of your form:


Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
fDragWindow Me
End Sub

Code:
' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
' API INFO:
'   The ReleaseCapture function releases the mouse capture from a window in the current
'   thread and restores normal mouse input processing. A window that has captured the mouse
'   receives all mouse input, regardless of the position of the cursor, except when a mouse
'   button is clicked while the cursor hot spot is in the window of another thread.
' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#If Win64 Then
Private Declare PtrSafe Function ReleaseCapture Lib "user32" () As Long
#Else
Private Declare Function ReleaseCapture Lib "user32" () As Long
#End If
' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
' API INFO:
'   The SendMessage function sends the specified message to a window or windows. It calls
'   the window procedure for the specified window and does not return until the window
'   procedure has processed the message.
'
' PARAMETER(S):
'   hWnd
'       [in] Handle to the window whose window procedure will receive the message. If this
'            parameter is HWND_BROADCAST, the message is sent to all top-level windows in
'            the system, including disabled or invisible unowned windows, overlapped windows,
'            and pop-up windows; but the message is not sent to child windows.
'   Msg
'       [in] Specifies the message to be sent.
'   wParam
'       [in] Specifies additional message-specific information.
'   lParam
'       [in] Specifies additional message-specific information.
' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#If Win64 Then
Private Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" ( _
            ByVal hwnd As LongPtr, _
                ByVal wMsg As Long, _
                    ByVal wParam As LongPtr, _
                        lParam As Any) As LongPtr
#Else
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
                            ByVal hWnd As Long, _
                                ByVal wMsg As Long, _
                                    ByVal wParam As Long, _
                                        lParam As Any) As Long


#End If
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2


Public Function fDragWindow(frm As Access.Form)

    With frm
        
        ReleaseCapture
        SendMessage .hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
    
    End With

End Function
 

Users who are viewing this thread

Back
Top Bottom