Results 1 to 15 of 15

Thread: How to change color of title bar?

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    7

    How to change color of title bar?

    How do I change the color of the main title bar and the border that follows aroung the form?

  2. #2
    Frenzied Member wiz126's Avatar
    Join Date
    Jul 2005
    Location
    Mars,Milky Way... Chit Chat Posts: 5,733
    Posts
    1,080

    Re: How to change color of title bar?

    Add This to a Module:
    VB Code:
    1. Declare Function SetSysColors Lib "user32" _
    2. (ByVal nChanges As Long, lpSysColor As _
    3. Long, lpColorValues As Long) As Long
    4.  
    5. Public Const COLOR_CAPTIONTEXT = 9

    And in your form add this:

    VB Code:
    1. Private Sub Form_Load()
    2. 'You can change the title bar text color to
    3. 'anytihng you want by changing the "VbBlack to Whatever you want"
    4.   s = SetSysColors(1, COLOR_CAPTIONTEXT, vbBlack)
    5. End Sub
    6.  
    7.  
    8. Private Sub Form_Unload(Cancel As Integer)
    9. 'To set default colors...... (Don't Change or remove this)
    10.   s = SetSysColors(1, COLOR_CAPTIONTEXT, vbWhite)
    11. 'Removing this will make all app's Titlebar text to be that color!!
    12. End Sub

    You Could Make Your Own form like this: http://www.vbforums.com/showthread.php?p=2104006
    Last edited by wiz126; Jan 23rd, 2006 at 07:38 PM.
    1) If your post has been adequately answered please click in your post on "Mark Thread Resolved".
    2) If someone has been useful to you please show your respect by rating their posts.
    3) Please use [highlight="VB"] 'your code goes in here [/highlight] tags when posting code.
    4) Before posting your question, make sure you checked this links:
    MICROSOFT MSDN -- VB FORUMS SEARCH

    5)Support Classic VB - A PETITION TO MICROSOFT

    ___________________________________________________________________________________
    THINGS TO KNOW ABOUT VB: || VB Examples/Demos
    What are Classes?
    || -
    Where to place a sub/function?(global) || Webbrowser control

  3. #3
    New Member
    Join Date
    Jun 2022
    Posts
    5

    Re: How to change color of title bar?

    I tried that code and it says s and vblack aren't declared

  4. #4
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    7,803

    Re: How to change color of title bar?

    This thread is ancient. That was posted 16 years ago. For all we know that code was meant for Windows 98.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  5. #5
    PowerPoster
    Join Date
    Nov 2017
    Posts
    2,090

    Re: How to change color of title bar?

    Quote Originally Posted by PumpkinPie View Post
    I tried that code and it says s and vblack aren't declared
    That code doesn't use vblack, it uses vbBlack. If you are using VB 6.0, vbBlack is declared. If you aren't using VB 6.0, then that code probably isn't what you should be using anyway.

  6. #6
    New Member
    Join Date
    Jun 2022
    Posts
    5

    Re: How to change color of title bar?

    Oh I didn't notice that lmfao

  7. #7
    New Member
    Join Date
    Jun 2022
    Posts
    5

    Re: How to change color of title bar?

    Sorry the vblack was a typo in my reply, in my code it's vbBlack

  8. #8
    PowerPoster
    Join Date
    Nov 2017
    Posts
    2,090

    Re: How to change color of title bar?

    And are you using Visual Basic 6.0?

  9. #9
    New Member
    Join Date
    Jun 2022
    Posts
    5

    Re: How to change color of title bar?

    Honestly I'm not sure

  10. #10
    PowerPoster
    Join Date
    Nov 2017
    Posts
    2,090

    Re: How to change color of title bar?

    Well, that's something you really should be aware of. Click around in the Help menu and try to find an About section that will tell you what program you are using.

  11. #11
    New Member
    Join Date
    Jun 2022
    Posts
    5

    Re: How to change color of title bar?

    Wait It's a program? I thought you meant a version of the Visual Basic language, the program I'm using is Visual Studio Professional 2022

  12. #12
    PowerPoster
    Join Date
    Nov 2017
    Posts
    2,090

    Re: How to change color of title bar?

    The other thing to note is that, vbBlack has a value of 0, so you could try just replacing vbBlack in the code with 0. But since you're almost certainly using a version of VB.NET, and not VB 6.0, I can't confirm that that code will work even with that change.

  13. #13
    PowerPoster
    Join Date
    Nov 2017
    Posts
    2,090

    Re: How to change color of title bar?

    Quote Originally Posted by PumpkinPie View Post
    Wait It's a program? I thought you meant a version of the Visual Basic language, the program I'm using is Visual Studio Professional 2022
    Ok, yeah. The posted code is specifically for Visual Basic 6.0. Good luck.

  14. #14
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,140

    Re: How to change color of title bar?


  15. #15
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,095

    Re: How to change color of title bar?

    Quote Originally Posted by PumpkinPie View Post
    Wait It's a program? I thought you meant a version of the Visual Basic language, the program I'm using is Visual Studio Professional 2022
    That is the lastest version of VB.Net, much different than VB6 which is from Visual Studio 6 (1998) There is another section of this forum for VB.Net related questions.

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