Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

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:

 

 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

UCM

>-)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...