Caption Bar Color

What you could do...

Divil's right, you can't change the colors or font of the caption bar directly, however, what you could do is bypass it altogeather and build your own...

1st: create a label ( or other control ) and design it as you wish as well as place it whereever you wish ( doesn't have to be accross the top of the form )

2nd: rename it to:     YourTitleBar

3rd: set both the form text to null and the captionbox to false in the form's properties... Additionally, set the form's FormBorderStyle to (None)---NOTE: this will Only work if the control (with the mouse e. event code in it) is on the form itself and NOT on a panel or tabcontrol, ect...

4th: put the following code in your form:
Visual Basic:
Dim Mouse_Offset As Point


  Private Sub YourTitleBar_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles YourTitleBar.MouseDown
    Mouse_Offset = New Point(-e.X - YourTitleBar.Left, -e.Y - YourTitleBar.Top)
  End Sub

  Private Sub YourTitleBar_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles YourTitleBar.MouseMove
    If e.Button = MouseButtons.Left Then
      Dim mousePos As Point = Control.MousePosition
      mousePos.Offset(Mouse_Offset.X, Mouse_Offset.Y)
      Location = mousePos
    End If
  End Sub

NOTE: you can create your own buttons, labels, or anything else to maximize, minimize, and normalize the form as well as end the program by putting in the button's ( or whatever control you assign for this purpose ) _Click( blah blah ) event like:

Visual Basic:
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Me.WindowState = FormWindowState.Minimized
  End Sub

  Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    Me.WindowState = FormWindowState.Normal
  End Sub

  Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Me.WindowState = FormWindowState.Maximized
  End Sub

  Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    End
  End Sub
 
Back
Top