[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Charles A. Lackman

10/8/2004 5:34:00 PM

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


1 Answer

Phil Williams

10/8/2004 6:33:00 PM

0

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.

"Charles A. Lackman" wrote:

> 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
>
>
>