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

Re: Owner draw on the MainMenu and MenuItem by Mick

Mick
Mon Aug 09 07:24:49 CDT 2004

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

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


"Tim Haughton" <timREMOVE.haughtonME@omnibus.SPAMco.uk> wrote in message
news:%dIRc.316495$pF1.39505@news.easynews.com...
> 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
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004