Page 2 of 2 FirstFirst 12
Results 41 to 44 of 44

Thread: Change Menu color?

  1. #41
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Change Menu color?

    i even tried to change the value of the const but it didnt like the RGB at all and couldnt figure out how to change it to HEX. a search on VBF gave me no luck.

    Complete project attached.
    username/password: test

    wouldnt let me attach: file too large.
    can download project here:

  2. #42
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Change Menu color?

    Havent finished but giot the menu bar to draw correctly but not the submenus.
    VB Code:
    1. Dim mi As MENUINFO
    2.     With mi
    3.         .cbSize = Len(mi)
    4.         .fMask = MIM_BACKGROUND
    5.         .hbrBack = CreateSolidBrush(vbRed) 'RGB(111, 140, 223)
    6.         SetMenuInfo GetMenu(Me.hWnd), mi  'main menu bar
    7.        
    8.         .fMask = MIM_BACKGROUND Or MIM_APPLYTOSUBMENUS
    9.         .hbrBack = CreateSolidBrush(vbRed) 'RGB(111, 140, 223)
    10.         SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 0), mi  'File menu (item 0)
    11.        
    12.         .hbrBack = CreateSolidBrush(vbRed) 'RGB(111, 140, 223)
    13.         SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 1), mi 'Add menu (item 1)
    14.        
    15.         .hbrBack = CreateSolidBrush(vbRed) 'RGB(111, 140, 223)
    16.         SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 2), mi 'View menu (item 2)
    17.        
    18.         .hbrBack = CreateSolidBrush(vbRed) 'RGB(111, 140, 223)
    19.         SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 3), mi 'Settings menu (item 3)
    20.        
    21. '        .hbrBack = CreateSolidBrush(RGB(111, 140, 223))
    22.     End With
    23.    
    24.     DrawMenuBar Me.hWnd
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #43
    Addicted Member
    Join Date
    Sep 2008
    Posts
    255

    Re: Change Menu color?

    the code is still useful in year 2008, thank you.

    I want to ask a question:
    I have a menu with four items : File, Edit, Tools, Help.

    Can I just make the menu bar "Help" in red color while the others three menu items (that is, File, Edit and Tools) remains default grey color.

    Thank you a lo

  4. #44
    Lively Member
    Join Date
    Aug 2009
    Posts
    113

    Re: Change Menu color?

    it doesnt work if the menu is invisible! I like to hide the main menu and use the menu in a ownerdrawn menu

Page 2 of 2 FirstFirst 12

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