Hello,
How do I change the menu colors?
Thank you for any replys,
Stilekid007
Printable View
Hello,
How do I change the menu colors?
Thank you for any replys,
Stilekid007
Check my sample code in THIS THREAD .
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:
Option Explicit Private Const MIM_BACKGROUND As Long = &H2 Private Const MIM_APPLYTOSUBMENUS As Long = &H80000000 Private Type MENUINFO cbSize As Long fMask As Long dwStyle As Long cyMax As Long hbrBack As Long dwContextHelpID As Long dwMenuData As Long End Type Private Declare Function DrawMenuBar Lib "user32" _ (ByVal hWnd As Long) As Long Private Declare Function GetSubMenu Lib "user32" _ (ByVal hMenu As Long, ByVal nPos As Long) As Long Private Declare Function GetMenu Lib "user32" _ (ByVal hWnd As Long) As Long Private Declare Function SetMenuInfo Lib "user32" _ (ByVal hMenu As Long, _ mi As MENUINFO) As Long Private Declare Function CreateSolidBrush Lib "gdi32" _ (ByVal crColor As Long) As Long Private Sub Command1_Click() Dim mi As MENUINFO With mi .cbSize = Len(mi) .fMask = MIM_BACKGROUND .hbrBack = CreateSolidBrush(vbYellow) SetMenuInfo GetMenu(Me.hWnd), mi 'main menu bar .fMask = MIM_BACKGROUND Or MIM_APPLYTOSUBMENUS .hbrBack = CreateSolidBrush(vbCyan) SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 0), mi 'File menu (item 0) .hbrBack = CreateSolidBrush(vbGreen) SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 1), mi 'Edit menu (item 1) .hbrBack = CreateSolidBrush(vbRed) SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 2), mi 'Select menu (item 2) End With DrawMenuBar Me.hWnd End Sub
Thank you so much! :thumb:
Stilekid007 :wave:
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! ;)
I was going to reply with few recommendation but since you did figure it out then it would be pointless.
Glad you liked it. :wave: