开发者

Making WinForm ContextMenu Background Gray?

开发者 https://www.devze.com 2023-01-03 19:18 出处:网络
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 c

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消