Menu Items

  • Thread starter Charles A. Lackman
  • Start date
C

Charles A. Lackman

Hello,

I have created a rectangle that is filled with a solid color (5 of them) and
drew them along with the text into the Menu items using the MeasureItem and
DrawItem Events and it worked great.

The problem that I am experiencing is that when you move your mouse through
the menu items it does not highlight them. I have tried to track the events
using the MenuItem Select Event and also the sender.Index and the e.Index
inside the DrawEvent. I am not able to make this work and sure would
appreciate your assistance.

I can change the background color using the following:

If e.State.Focus Then
If sender.index = 0 Then
e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds)
Else
e.Graphics.FillRectangle(SystemBrushes.Menu, e.Bounds)
End If

but it does not change the item that is not an idex or 0 back to the menu
background color.

Thanks,
Chuck
 
G

Guest

I use C# not VB, but instead of

If e.State.Focus Then

use

If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then

Regards,
Phil.
 

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