Results 1 to 21 of 21

Thread: [TUTORIAL] How To: Customize TitleBar!

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    493

    [TUTORIAL] How To: Customize TitleBar!

    Here is my tutorial on how to customize your top bar!

    Requirements:

    Visual Basic 2008

    DotNetBar

    Slight Programming Skill!

    1) Open A new Visual Basic Project and call it whatever you want!

    2) Go To the DotNetBar tab in the Tools Menu

    3) Place A Bar down

    4) Right click the bar and click properties

    5) Once your at properties look for dock

    6) Click it and select the Top Button.

    7) Click on the Bar and a Arrow should appear click it and Click Add Button and name it Exit

    8) Right click The button and Click View code

    9) Type in
    Code:
    Close()
    10) If you want Add another button and name it Minimize

    11) Right Click and view the code of that!

    12) Type in
    Code:
    Me.WindowState = FormWindowState.Minimized
    13) If you want create another button and call it Maximize

    14) View the code the type in
    Code:
    Me.WindowState = FormWindowState.Maximized
    15) Click on the Bar and click View Code Add this to Public Class Form1

    Code:
        ' Tracks whether the form is in drag mode. If it is, mouse movements
        ' over the picturebox will be translated into form movements.
        Dim Dragging As Boolean
    
        ' Stores the offset where the picturebox is clicked.
        Dim PointClicked As Point
    16) Then just add this WHOLE code to your project
    Code:
      Private Sub Bar1_MouseDown(ByVal sender As Object, _
      ByVal e As System.Windows.Forms.MouseEventArgs) Handles Bar1.MouseDown
    
            If e.Button = MouseButtons.Left Then
                Dragging = True
                PointClicked = New Point(e.X, e.Y)
            Else
                Dragging = False
            End If
    
        End Sub
    
        Private Sub Bar1_MouseMove(ByVal sender As Object, _
          ByVal e As System.Windows.Forms.MouseEventArgs) Handles Bar1.MouseMove
    
            If Dragging Then
                Dim PointMoveTo As Point
    
                ' Find the current mouse position in screen coordinates.
                PointMoveTo = Me.PointToScreen(New Point(e.X, e.Y))
    
                ' Compensate for the position the control was clicked.
                PointMoveTo.Offset(-PointClicked.X, -PointClicked.Y - (Me.Height - Me.ClientRectangle.Height))
                ' Move the form.
                Me.Location = PointMoveTo
            End If
    
        End Sub
    
        Private Sub Bar1_MouseUp(ByVal sender As Object, _
          ByVal e As System.Windows.Forms.MouseEventArgs) Handles Bar1.MouseUp
    
            Dragging = False
    
        End Sub
    And thats all now you should have a cool looking Titlebar.

    Pictures here: http://www.vbforums.com/showpost.php...72&postcount=6

    Thanks to .Paul. for the great info on how to move the Form without the Titlebar
    Last edited by VB6Learner; Sep 13th, 2008 at 08:23 PM.

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