|
-
Jul 5th, 2005, 06:02 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Changing the menu background color.
Hello,
How do I change the menu colors?
Thank you for any replys,
Stilekid007
 Originally Posted by stilekid007
-
Jul 5th, 2005, 06:13 PM
#2
Re: Changing the menu background color.
Check my sample code in THIS THREAD .
-
Jul 5th, 2005, 06:19 PM
#3
Thread Starter
Hyperactive Member
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:
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! 
Stilekid007
 Originally Posted by stilekid007
-
Jul 5th, 2005, 06:28 PM
#4
Thread Starter
Hyperactive Member
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!
 Originally Posted by stilekid007
-
Jul 5th, 2005, 06:43 PM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|