Results 1 to 21 of 21

Thread: [TUTORIAL] How To: Customize TitleBar!

  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.

  2. #2
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [TUTORIAL] How To: Customize TitleBar!

    Wrong subforum mate! This belongs in the CodeBank.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    493

    Re: [TUTORIAL] How To: Customize TitleBar!

    Ya sorry I never knew where to put this! I looked for something like tutorial couldent find it. So I put it here. Well what do you think of it any ways?

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,458

    Re: [TUTORIAL] How To: Customize TitleBar!

    can you post a screenshot?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    493

    Re: [TUTORIAL] How To: Customize TitleBar!

    Ya sure I will later!

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    493

    Re: [TUTORIAL] How To: Customize TitleBar!

    Here is the screenshot for those that requested one!
    Here is the whole Project:
    If the project is crahing then download DotNetBar:
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by VB6Learner; Sep 13th, 2008 at 08:30 PM.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    493

    Re: [TUTORIAL] How To: Customize TitleBar!

    Oh and for those that wanted the Normal Window Button here is the code:
    Code:
    Me.WindowState = FormWindowState.Normal

  8. #8
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [TUTORIAL] How To: Customize TitleBar!

    Nice... IMHO, you should PM a mod to move the thread to the CodeBank so ppl can make the most out of it.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    493

    Re: [TUTORIAL] How To: Customize TitleBar!

    Ya sure! Who should I PM?

  10. #10
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [TUTORIAL] How To: Customize TitleBar!

    Try RobDog or kleinma.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  11. #11
    Lively Member astroanu2004's Avatar
    Join Date
    Jan 2008
    Location
    Sri Lanka
    Posts
    108

    Re: [TUTORIAL] How To: Customize TitleBar!

    does this work in the express edition?

  12. #12
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: [TUTORIAL] How To: Customize TitleBar!

    Quote Originally Posted by astroanu2004
    does this work in the express edition?
    Yes, the express edition can handle custom controls like the dotnetbar
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    493

    Re: [TUTORIAL] How To: Customize TitleBar!

    Can this topic be moved to codebanks?

  14. #14
    Frenzied Member
    Join Date
    Jul 2006
    Location
    MI
    Posts
    1,961

    Re: [TUTORIAL] How To: Customize TitleBar!

    I totally don't understand what this tutorial is about. The screenshot of your "cool" titlebar looks like nothing more than the standard VS toolbar component with buttons. So why would you want buttons on your titlebar as you show it? You already have the standard buttons in the upper right corner for minimizing, maximizing & closing.

  15. #15
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [TUTORIAL] How To: Customize TitleBar!

    My guess is it is supposed to replace the title, not complement it.

    I also personally hate applications that customize the title bar at all (like google chrome). It usually takes away standard functionality because they never fully replace all the features with comparable ones, only the most basic or common features. Does your title bar give you standard title bar options when you right click it? What about my ultramon multi monitor app buttons that it automatically inserts extra functionality into any standard windows titlebar? That is probably the biggest reason I hate skinned apps/custom titlebars, but I will concede not a huge number of people run such a monitor setup.

    I will move to codebank.

  16. #16
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [TUTORIAL] How To: Customize TitleBar!

    Quote Originally Posted by kleinma
    My guess is it is supposed to replace the title, not complement it.

    I also personally hate applications that customize the title bar at all (like google chrome). It usually takes away standard functionality because they never fully replace all the features with comparable ones, only the most basic or common features. Does your title bar give you standard title bar options when you right click it? What about my ultramon multi monitor app buttons that it automatically inserts extra functionality into any standard windows titlebar? That is probably the biggest reason I hate skinned apps/custom titlebars, but I will concede not a huge number of people run such a monitor setup.

    I will move to codebank.
    You wrote the UltraMon application?!? I am playing with a trial version of that just now, and so far I am finding it very useful!!! Well done!!!!

  17. #17
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [TUTORIAL] How To: Customize TitleBar!

    lol, no sorry if I gave that impression.. I just meant I own a copy of it...

    I have several apps that just don't work with it because they use customized title bars or skinned windows.

  18. #18
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [TUTORIAL] How To: Customize TitleBar!

    Ha ha!! I was away to be giving you lot of credit there!! I know what you mean though, certain apps don't like UltraMon, or the other way round, and you lose the ability to switch monitors quickly which is a bit annoying.

  19. #19
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: [TUTORIAL] How To: Customize TitleBar!

    Quote Originally Posted by kleinma
    lol, no sorry if I gave that impression.. I just meant I own a copy of it...

    I have several apps that just don't work with it because they use customized title bars or skinned windows.
    Like WindowsMediaPlayer and Office 2007? I hate those skins, MS ****ed the poodle on those programs.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  20. #20
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [TUTORIAL] How To: Customize TitleBar!

    Quote Originally Posted by JuggaloBrotha
    Like WindowsMediaPlayer and Office 2007? I hate those skins, MS ****ed the poodle on those programs.
    nope they work just fine, and they both have normal title bars...

    So I am not sure what you mean...

    I also don't consider either of those applications to be "skinned" with maybe the exception of the new office thing in the upper left corner, but I can still double click the upperleft corner to close the app.

  21. #21
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,274

    Re: [TUTORIAL] How To: Customize TitleBar!

    It should be noted that there's a difference between customising the existing title bar on a form, which can be done, and removing it and replacing it with a fake one. If you customise the real title bar then any windows functions that rely on the real title bar will work. There's no need to worry about implementing your own drag and drop or creating your own buttons. You may have seen that Office 2007 apps sometimes momentarily revert to the standard title bar under heavy system load. That's because the system hasn't had time to redraw the title bar using the app's specs, so the standard one gets drawn instead.

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