Question

I'm trying to create a MainMenu for my application that looks similar to the one used by Mozilla Firefox:

So that it displays over aero glass. I can think of a few ways to do this, except they would be ugly, and probably ruin the experience of the program due to them being hackish.

I'm wondering if there is a way to custom draw the MainMenu control, similar to how you can override the OnPaint method on other controls (which for some reason, MainMenu doesn't have). Or if that is not possible, what sort of hacky ways could I use that wouldn't ruin the UX.

Yes, I'm sure there is a ridiculously easy way to do this in WPF, and I would love to be able to take the time to learn it, but my application is already in a semi-mature stage, and it would be extremely inconvenient to switch to a different UI platform at this point.

Was it helpful?

Solution

I ended up creating my own control that inherits ToolStripMenuItem and overriding OnPaint and drawing the text with DrawThemeTextEx, and using a modified version of the MenuStrip renderer found here that omits the rendering of header text (so it doesn't conflict with DrawThemeTextEx and the background bar of the ToolStrip.

Final product looks like this:

:)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top