Making WinForm ContextMenu Background Gray?
Context menus seem to have a default white background.
This looks pre开发者_如何转开发tty 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?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.
contextMenuStrip1.BackColor = Color.Pink;
Put that in the onLoad handler, or go to the properties and change the BackColor there :o)
精彩评论