Owner draw on the MainMenu and MenuItem

T

Tim Haughton

Like most fans of eye candy, I've always thought the standard MainMenu
control was a bit drab. After looking at third party components, I decided
to see if I could brute force it into looking nice.

I set the owner draw on the menu items to true, and draw the MenuItems
differently depending on whether or not their selected, thus providing nice
Outlook 2003 menu styling. The only problem is, there is no 'unselected'
event, so I can't redraw the item when the mouse or keyboard has moved
elsewhere. The only thing I could find that semi-worked, was to call an
internal method on the MenuItem object to force a redraw. This works OK for
everything apart from the root level MenuItem. When I try this method on the
root level MenuItem it, for want of a better phrase, spags out and messes up
the painting of the whole form. Not grumbling too much, it is afterall an
internal method.

Anyone know of a way to work with the MainMenu et. al. classes to make them
look nice rather than replacing them?

Cheers,

Tim H
 
M

Mick Doherty

You can check the current state of the menuitem by checking e.state for
DrawItemState.Selected and DrawItemState.HotLight. For a complete ownerdraw
MenuItem example take a look at my office style menu class.
http://dotnetrix.co.uk/menus.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top