Results 1 to 9 of 9

Thread: Removing header bar

  1. #1
    New Member
    Join Date
    Aug 12
    Posts
    8

    Removing header bar

    Hey all

    Does anyone of you know how to remove the Header bar( not borderstyle none) So i can still size my form but not having the header.

  2. #2
    PowerPoster Edgemeal's Avatar
    Join Date
    Sep 06
    Location
    WindowFromPoint(x,y)
    Posts
    3,135

    Re: Removing header bar

    Set forms ControlBox to false and remove the form text in properties, or set them in form_load at runtime.

    Me.ControlBox = False
    Me.Text = ""

  3. #3
    Frenzied Member
    Join Date
    Sep 06
    Posts
    1,237

    Re: Removing header bar

    Add this to your Form_Load
    Code:
            Me.ControlBox = False
            Me.Text = ""

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 12
    Posts
    5,471

    Unhappy Re: Removing header bar

    D'oh!

  5. #5
    New Member
    Join Date
    Aug 12
    Posts
    8

    Re: Removing header bar

    ty, can i also get rid of the top border. Only the top one

  6. #6
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 12
    Posts
    5,471

    Re: Removing header bar

    No. Why would you want to?

  7. #7
    PowerPoster Edgemeal's Avatar
    Join Date
    Sep 06
    Location
    WindowFromPoint(x,y)
    Posts
    3,135

    Re: Removing header bar

    Quote Originally Posted by dnear View Post
    ty, can i also get rid of the top border. Only the top one
    Nope, you'd have to use a borderless form, add (draw?) your own borders and the needed code to resize the form.

    Other then that, if you just don't want to allow the user to resize the form from the top you could change the message that makes that happen...
    Code:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' set form style
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable
        Me.ControlBox = False
        Me.Text = ""
    End Sub
    
    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        MyBase.WndProc(m)
        If m.Msg = &H84 Then ' WM_NCHITTEST = &H84 'non client hit-test
            Select Case m.Result.ToInt32()
                ' 12-14 = detect mouse over top/top-left/top-right borders
                Case 12 To 14 ' see, http://msdn.microsoft.com/en-us/library/ms645618%28VS.85%29.aspx
                    ' change the resize cursor when mouse is over form borders.
                    m.Result = CType(1, IntPtr) ' 1=Client, 2=Caption(allow drag form with mouse when on borders).
            End Select
        End If
    End Sub
    Last edited by Edgemeal; Aug 25th, 2012 at 12:52 PM. Reason: typo

  8. #8
    New Member
    Join Date
    Aug 12
    Posts
    8

    Re: Removing header bar

    thanks all

    Does anyone of you know how to change the border style and header style??
    Ive heard you can do that with package you can download.

    But are there free ones too? and how to install it

  9. #9
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 12
    Posts
    5,471

Posting Permissions

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