Results 1 to 5 of 5

Thread: [RESOLVED] Changing the menu background color.

  1. #1

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Resolved [RESOLVED] Changing the menu background color.

    Hello,

    How do I change the menu colors?

    Thank you for any replys,
    Stilekid007
    Quote Originally Posted by stilekid007
    I RATE ALL HELPFULL POSTS!

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Changing the menu background color.

    Check my sample code in THIS THREAD .

  3. #3

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Re: Changing the menu background color.

    Hello RhinoBull,

    Yea I just found that thread a few seconds ago.

    With this code that you gave in the other thread, it doesn't edit the color of the submenu.

    Example - If my menu looks like this:

    File - Edit - Help
    ...Save

    Then the background of Save is still grey. Is there a way to get it to change the color of that background also?

    Here is the code from the other thread.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Const MIM_BACKGROUND As Long = &H2
    4. Private Const MIM_APPLYTOSUBMENUS As Long = &H80000000
    5.  
    6. Private Type MENUINFO
    7.     cbSize As Long
    8.     fMask As Long
    9.     dwStyle As Long
    10.     cyMax As Long
    11.     hbrBack As Long
    12.     dwContextHelpID As Long
    13.     dwMenuData As Long
    14. End Type
    15.  
    16. Private Declare Function DrawMenuBar Lib "user32" _
    17.     (ByVal hWnd As Long) As Long
    18.  
    19. Private Declare Function GetSubMenu Lib "user32" _
    20.     (ByVal hMenu As Long, ByVal nPos As Long) As Long
    21.  
    22. Private Declare Function GetMenu Lib "user32" _
    23.     (ByVal hWnd As Long) As Long
    24.  
    25. Private Declare Function SetMenuInfo Lib "user32" _
    26.     (ByVal hMenu As Long, _
    27.      mi As MENUINFO) As Long
    28.  
    29. Private Declare Function CreateSolidBrush Lib "gdi32" _
    30.     (ByVal crColor As Long) As Long
    31.  
    32. Private Sub Command1_Click()
    33. Dim mi As MENUINFO
    34.    
    35.     With mi
    36.         .cbSize = Len(mi)
    37.        
    38.         .fMask = MIM_BACKGROUND
    39.         .hbrBack = CreateSolidBrush(vbYellow)
    40.         SetMenuInfo GetMenu(Me.hWnd), mi  'main menu bar
    41.        
    42.         .fMask = MIM_BACKGROUND Or MIM_APPLYTOSUBMENUS
    43.         .hbrBack = CreateSolidBrush(vbCyan)
    44.         SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 0), mi 'File menu (item 0)
    45.        
    46.         .hbrBack = CreateSolidBrush(vbGreen)
    47.         SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 1), mi 'Edit menu (item 1)
    48.        
    49.         .hbrBack = CreateSolidBrush(vbRed)
    50.         SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 2), mi 'Select menu (item 2)
    51.        
    52.     End With
    53.    
    54.     DrawMenuBar Me.hWnd
    55.  
    56. End Sub

    Thank you so much!
    Stilekid007
    Quote Originally Posted by stilekid007
    I RATE ALL HELPFULL POSTS!

  4. #4

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Re: Changing the menu background color.

    OH WAIT! I see - each drop down menu background color is different! I get it. Ok, I can change those colors now to all the same.

    Thank you so much for your help!
    Stilekid007
    P.S. I RATED YOU!
    Quote Originally Posted by stilekid007
    I RATE ALL HELPFULL POSTS!

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: [RESOLVED] Changing the menu background color.

    I was going to reply with few recommendation but since you did figure it out then it would be pointless.
    Glad you liked it.

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