Apr 1st, 2005, 10:59 PM
#1
Thread Starter
Admodistrator
Change Menu color?
Is it possible to change the color of the menu on the top of your vb program? The menu im talking about is in Tools->Menu Editor
Once you make it, it stays stupid gray and i wanted to know how i could change it!...thanks
Apr 1st, 2005, 11:07 PM
#2
Re: Change Menu color?
The most I was ever to do was change the color on the menuitems, but not the actual menubar
that is always displayed. You need some APIs to color the submenus. Interested still?
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
Apr 1st, 2005, 11:10 PM
#3
Re: Change Menu color?
Ooo, that's my favorite - create one menu and at least one submenu item:
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 'this could a File menu perhaps
End With
DrawMenuBar Me.hWnd
End Sub
EDIT: my appologies - I should've mentioned that this sample was inspired by Randy Birch's original article (link in my signature).
Last edited by RhinoBull; Aug 28th, 2006 at 01:37 PM .
Apr 1st, 2005, 11:13 PM
#4
Thread Starter
Admodistrator
Re: Change Menu color?
edit**
durr "Command1"
thanks alot again!
edit2**
there a way to change the text color also?
Apr 1st, 2005, 11:17 PM
#5
Re: Change Menu color?
Prop to you RB! I had worked on this a few years ago and couldnt get the main menubar.
's up!
Oh ya and heres a half dozen Reps even though you dont want them
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
Apr 1st, 2005, 11:17 PM
#6
Thread Starter
Admodistrator
Re: Change Menu color?
i wish i could rate him but i cant : (
can i get a pic on there too?
Apr 1st, 2005, 11:20 PM
#7
Re: Change Menu color?
For pictures in menu visit www.vbaccelerator.com - Steve Mac has all you need.
Apr 1st, 2005, 11:21 PM
#8
Thread Starter
Admodistrator
Re: Change Menu color?
nice, but can you lead me in the right direction for which section to go to?
Apr 1st, 2005, 11:28 PM
#9
Re: Change Menu color?
Originally Posted by
RobDog888
... I had worked on this a few years ago and couldnt get the main menubar. ...
I posted similar sample two months ago:
http://www.vbforums.com/showthread.php?t=322187
Apr 1st, 2005, 11:37 PM
#10
Thread Starter
Admodistrator
Re: Change Menu color?
thats a good thread! im sorry to keep bugging you, but how could i use a rgb value?
Apr 1st, 2005, 11:46 PM
#11
Re: Change Menu color?
You can use this:
VB Code:
Form1.BackColor = RGB(22, 44, 66)
Apr 1st, 2005, 11:54 PM
#12
Thread Starter
Admodistrator
Re: Change Menu color?
cool, ill try and use that
Apr 1st, 2005, 11:56 PM
#13
Re: Change Menu color?
After coming back to this, I thought that you wanted to change the menu still.
Glad it was a new question.
Apr 2nd, 2005, 12:00 AM
#14
Thread Starter
Admodistrator
Re: Change Menu color?
it works. thanks alot guys!
you had exactly what i was looking for
Apr 2nd, 2005, 12:01 AM
#15
Apr 2nd, 2005, 12:14 AM
#16
Thread Starter
Admodistrator
Re: Change Menu color?
wow thankyou sooo much, you made me the most beautiful GUI!
Apr 2nd, 2005, 12:14 AM
#17
Thread Starter
Admodistrator
Re: Change Menu color?
And heres how i used it!:
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(RGB(244, 147, 8))
SetMenuInfo GetMenu(Me.hWnd), mi 'main menu bar
.fMask = MIM_BACKGROUND Or MIM_APPLYTOSUBMENUS
.hbrBack = CreateSolidBrush(RGB(244, 147, 8))
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 0), mi 'File menu (item 0)
.hbrBack = CreateSolidBrush(RGB(244, 147, 8))
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 1), mi 'Edit menu (item 1)
.hbrBack = CreateSolidBrush(RGB(244, 147, 8))
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 2), mi 'Select menu (item 2)
End With
DrawMenuBar Me.hWnd
End Sub
its a very very nice orange color
Apr 2nd, 2005, 12:27 AM
#18
Re: Change Menu color?
Post a picture
Apr 2nd, 2005, 12:33 AM
#19
Re: Change Menu color?
So its an Orange menu? I thougt you were going to use a texture or image background?
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
Apr 2nd, 2005, 12:47 AM
#20
Re: Change Menu color?
So you'll feel like you're in Florida on a citrus plantation.
Apr 2nd, 2005, 01:01 AM
#21
Thread Starter
Admodistrator
Re: Change Menu color?
you want an awesome pic? here it is.
Another few questions, how can i change the scrollbar color? i just want it a bit darker.
Last edited by |2eM!x; Apr 12th, 2005 at 08:13 PM .
Apr 2nd, 2005, 01:07 AM
#22
Re: Change Menu color?
Ah, so the bitmap was for the forms background.
What type of app is this going to be?
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
Apr 2nd, 2005, 01:11 AM
#23
Thread Starter
Admodistrator
Re: Change Menu color?
its for a game, lets you get updates and such
is there a way to add a picture behind a textbox so you can see it?
Apr 2nd, 2005, 01:13 AM
#24
Re: Change Menu color?
Not that I know of off hand, but if you can use a label control instead then the background can show
through when its set to transparent.
Is that what you need?
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
Apr 2nd, 2005, 01:20 AM
#25
Thread Starter
Admodistrator
Re: Change Menu color?
no, they need to be able to type into it : (, i think itd look really neat to have a picture behind it, ill try and do it myself but all know how that will end up
Apr 2nd, 2005, 01:24 AM
#26
Re: Change Menu color?
But then wouldnt it be hard to see the text?
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
Apr 2nd, 2005, 01:27 AM
#27
Thread Starter
Admodistrator
Re: Change Menu color?
i guess so, but i was going to make it somewaht transparent and on the left, as you can see i dont have very much room on my form..maybe ill just leave it out.
Apr 2nd, 2005, 02:00 AM
#28
Re: Change Menu color?
Attached Files
Apr 2nd, 2005, 02:13 AM
#29
Thread Starter
Admodistrator
Re: Change Menu color?
um, well im not sure what im supposed to do with that...
i tested out, but what am i supposed to do? Drag the label around?
it doesnt go over the textboxes either in my vb : (
Apr 2nd, 2005, 02:15 AM
#30
Thread Starter
Admodistrator
Re: Change Menu color?
wow, i figured it out, but i had to move the picture box over the text before runtime..
thanks again!
edit**
wait then they wont be able to type in the textbox : (
thanks anyways, ill just leave it
Apr 2nd, 2005, 09:11 AM
#31
Re: Change Menu color?
You could probably fake it when the user clicks the picture box. When this happens you can place the pb behind
the textbox and the textbox will be in fornt ready for entries. Then switch back when the cursor leaves focus.
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
Apr 2nd, 2005, 12:37 PM
#32
Re: Change Menu color?
What are you guys trying to do ? Transparent textbox ? You need to BitBlt it and I posted quick sample project ...
Apr 2nd, 2005, 01:59 PM
#33
Thread Starter
Admodistrator
Re: Change Menu color?
yes, but they cant type thru it..its fine i just wont use it
Apr 2nd, 2005, 02:34 PM
#34
Re: Change Menu color?
Originally Posted by
|2eM!x
yes, but they cant type thru it. ...
Not sure I follow you. Do you want them to type or not? Sample I posted does allow this so what's the problem? If you don't want to allow typing then simply set Text1.Locked = True - that's it.
Jan 12th, 2006, 10:05 PM
#35
PowerPoster
Re: Change Menu color?
Originally Posted by
|2eM!x
And heres how i used it!:
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(RGB(244, 147, 8))
SetMenuInfo GetMenu(Me.hWnd), mi 'main menu bar
.fMask = MIM_BACKGROUND Or MIM_APPLYTOSUBMENUS
.hbrBack = CreateSolidBrush(RGB(244, 147, 8))
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 0), mi 'File menu (item 0)
.hbrBack = CreateSolidBrush(RGB(244, 147, 8))
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 1), mi 'Edit menu (item 1)
.hbrBack = CreateSolidBrush(RGB(244, 147, 8))
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 2), mi 'Select menu (item 2)
End With
DrawMenuBar Me.hWnd
End Sub
its a very very nice orange color
im not able to apply color to drop down menus in menu editor?
Jan 12th, 2006, 10:17 PM
#36
Thread Starter
Admodistrator
Re: Change Menu color?
What??
The code colors both the menu and the submenu items..
Jan 12th, 2006, 10:36 PM
#37
PowerPoster
Re: Change Menu color?
Originally Posted by
|2eM!x
What??
The code colors both the menu and the submenu items..
not for me... seems something is se wrong?
Jan 12th, 2006, 10:47 PM
#38
Thread Starter
Admodistrator
Re: Change Menu color?
Did you add a command button and click it
Jan 12th, 2006, 10:56 PM
#39
PowerPoster
Re: Change Menu color?
Originally Posted by
|2eM!x
Did you add a command button and click it
added it form_load. its not changing drop downs tho.
Jan 13th, 2006, 01:52 AM
#40
Re: Change Menu color?
This flag (MIM_APPLYTOSUBMENUS) should be painting the submenus. Can you attach a sample project showing the issue?
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
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