views:

66

answers:

2

Context menus seem to have a default white background.
This looks pretty nice, but for consistency's sake, I'd like the context menu to be gray like with any other application. How can I get this style for my context menu?

+1  A: 
contextMenuStrip1.BackColor = Color.Pink;

Put that in the onLoad handler, or go to the properties and change the BackColor there :o)

Chief17
Ok, cool! but... the context menu is flat, and the other ones appear to have depth. I just want my context menu to look the same as all the others.
Soo
By explicitly setting a background colour, you are forcing a user to have this colour, even if they change their Windows styles to something different.
adrianbanks
+2  A: 

Have a look at my answer for another similar question about menu items.

What you need to do is to use a ContextMenu instead of a ContextMenuStrip. This will pick up the default colours (ie. gray) and styles set in the underlying operating system instead of its own defined colours and styles.

adrianbanks
I'm using Visual C# 2008, and ContextMenuStrip is the only option in the toolbox (ContextMenu doesn't seem to be there)
Soo
@Soo: If you read my answer linked above, it tells you how to add `ContextMenu` into the toolbox.
adrianbanks
Ahh, I should have read more carefully, thanks!
Soo
While automatically getting the default OS colors and appearance for menus is why I always opt for the (technically) older ContextMenu, it doesn't easily support image icons out of the box. I've used [this](http://wyday.com/blog/2008/vista-menu-with-icons-in-c-sharp/) quite successfully in the past to do just that, though.
Yadyn