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 :wave:
Printable View
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 :wave:
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?
Ooo, that's my favorite - create one menu and at least one submenu item:
EDIT: my appologies :blush: - I should've mentioned that this sample was inspired by Randy Birch's original article (link in my signature).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**
durr "Command1"
thanks alot again!
edit2**
there a way to change the text color also?
Prop to you RB! I had worked on this a few years ago and couldnt get the main menubar.
:thumb: :thumb: 's up!
Oh ya and heres a half dozen Reps even though you dont want them ;) :p
i wish i could rate him but i cant : (
can i get a pic on there too?
For pictures in menu visit www.vbaccelerator.com - Steve Mac has all you need.
nice, but can you lead me in the right direction for which section to go to?
I posted similar sample two months ago:Quote:
Originally Posted by RobDog888
http://www.vbforums.com/showthread.php?t=322187
thats a good thread! im sorry to keep bugging you, but how could i use a rgb value?
You can use this:
VB Code:
Form1.BackColor = RGB(22, 44, 66)
cool, ill try and use that
After coming back to this, I thought that you wanted to change the menu still.
Glad it was a new question. :wave:
it works. thanks alot guys!
you had exactly what i was looking for :wave:
:thumb: :wave:
wow thankyou sooo much, you made me the most beautiful GUI!
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
Post a picture :)
So its an Orange menu? I thougt you were going to use a texture or image background?
So you'll feel like you're in Florida on a citrus plantation. :)
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.
Ah, so the bitmap was for the forms background.
:thumb:
What type of app is this going to be?
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?
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?
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
But then wouldnt it be hard to see the text?
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.
See attachments.
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 : (
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
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.
What are you guys trying to do ? Transparent textbox ? You need to BitBlt it and I posted quick sample project ...
yes, but they cant type thru it..its fine i just wont use it :thumb:
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.Quote:
Originally Posted by |2eM!x
im not able to apply color to drop down menus in menu editor?Quote:
Originally Posted by |2eM!x
What??
The code colors both the menu and the submenu items..
not for me... seems something is se wrong?Quote:
Originally Posted by |2eM!x
Did you add a command button and click it :D
added it form_load. its not changing drop downs tho.Quote:
Originally Posted by |2eM!x
This flag (MIM_APPLYTOSUBMENUS) should be painting the submenus. Can you attach a sample project showing the issue?