Results 1 to 16 of 16

Thread: Hide form's titlebar

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Madison, WI
    Posts
    1
    How do I hide a form's titlebar?

    Setting ControlBox, MaxButton, etc. to false and Caption to nothing works, but I need to keep the caption in the taskbar.

  2. #2
    Guest
    set borderstyle to none(0)

  3. #3
    Guest
    By default, when you set the BorderStyle to 0-None, the ShowInTaskBar property changes to False, so make sure you set it back to True.

  4. #4
    Guest
    well I would keep it false, because when you dont have a title bar, it gets a little screwed up,
    when you try to minimize the form(by clicking on the taskbar icon) nothing happens, you have to use your own minimize code,
    which isnt really a problem, but it kind of bugs me I cant minimize it by clicking in the taskbar.

  5. #5
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    Set ControlBox, MinButton and Maxbutton to False and set the caption to " " instead of ""...

  6. #6
    Guest
    Mad Compie: But that will set the caption to " ". Setting the BorderStyle to None will still keep the original caption.

  7. #7
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    Yes indead, I missed the plot.
    But you can create your own caption bar!
    Make a form only have a border or something.
    Draw your caption using AutoRedraw=True and Form.Print Method.
    In your Form_MouseMove Event check the absolute X Y values, if between a certain range, then use the SendMessage() API to move your Form while holding the mouse button.

  8. #8
    Guest
    Yes, you could create a TitleBar, but in this case he wants to hide the TitleBar on the Form but still keeping it in the TaskBar. Setting the BorderStyle to 0-None will accomplish this.

  9. #9
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341

    Try This....

    Border Style = 3
    Caption = ""
    ControlBox = False

    And Use..

    Public X2 As Double, Y2 As Double
    Public m_Down As Boolean

    Private Sub Form1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    m_Down = True
    X2 = X
    Y2 = Y
    end Sub

    Private Sub Form1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If (m_Down = True) Then
    Me.Move Me.Left - (X2 - X), Me.Top - (Y2 - Y)
    End If
    End Sub

    Private Sub Form1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    m_Down = False
    End Sub

    That should do it

  10. #10
    Guest
    this is a bit easier and Faster(uses API)


    Code:
    Private Declare Function ReleaseCapture Lib "user32" () As Long
    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
    
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Select Case Button
            Case 1
                ReleaseCapture
                SendMessage Me.hwnd, 161, 2, 0
        End Select
    End Sub

    and BTW your code doesnt even work.

  11. #11
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    Yes indeed, that's what I also had in mind.
    "SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)"

  12. #12
    Guest
    thank you!
    I never knew the constant names, just the value that was supposed to be in there.

  13. #13
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    You're welcome.

    Try also http://www.allapi.net, which contains an excellent API viewer with a lot of sample codes! ("API Guide")

  14. #14
    Guest
    oh yeah, I have that, but half the declares arent there, because everytime I try to update the damn thing, it gets about half way and then it just stops.

  15. #15
    Guest
    If you want all off the documented API's, I suggest you download the Platform SDK, however, in order to read/understnad them, you must have an understanding of C/C++.

  16. #16
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553

    Angry

    This is huge, this SDK from Bill. But I think that the 500MB download will slow down my system...

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