By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,682 Members | 1,376 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,682 IT Pros & Developers. It's quick & easy.

Owner Draw Menu Item

P: n/a
Hi there,

I have created an owner draw menu item using DrawItem and MeasureItem in
VB.NET. This seems to work well. I was wondering how I can do mouse over
effects in these menus. Basically the same as the dot net menus where they
get highlighted when the mouse moves over them.

Does anyone have any VB dot net examples or suggestions on how I could do
this?

Thanks
Devron
Nov 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
The Select event fires when a mouse moves over a menu item
"Devron Blatchford" <de****@auspine.com.au> wrote in message
news:uQ**************@tk2msftngp13.phx.gbl...
Hi there,

I have created an owner draw menu item using DrawItem and MeasureItem in
VB.NET. This seems to work well. I was wondering how I can do mouse over
effects in these menus. Basically the same as the dot net menus where they
get highlighted when the mouse moves over them.

Does anyone have any VB dot net examples or suggestions on how I could do
this?

Thanks
Devron

Nov 20 '05 #2

P: n/a
How do I handle the mouse_leave event to know when the mouse leaves the
item.?

Thanks
Devron
"Stephen" <gr******@bellatlantic.net> wrote in message
news:eO**************@tk2msftngp13.phx.gbl...
The Select event fires when a mouse moves over a menu item
"Devron Blatchford" <de****@auspine.com.au> wrote in message
news:uQ**************@tk2msftngp13.phx.gbl...
Hi there,

I have created an owner draw menu item using DrawItem and MeasureItem in
VB.NET. This seems to work well. I was wondering how I can do mouse over
effects in these menus. Basically the same as the dot net menus where they get highlighted when the mouse moves over them.

Does anyone have any VB dot net examples or suggestions on how I could do this?

Thanks
Devron


Nov 20 '05 #3

P: n/a
Hi Devron, You don't want to be looking at those events, you need to be
using the Draw Item event.

Inside the draw item even, we have the 'e' class (declared as
DrawItemEventArgs) and it allows you to draw the item depending on the state
of the item:

' /// Inside DrawItem

If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
Else
' The item is not selected, fill with white
End If

'///

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
"Devron Blatchford" <de****@auspine.com.au> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl...
How do I handle the mouse_leave event to know when the mouse leaves the
item.?

Thanks
Devron
"Stephen" <gr******@bellatlantic.net> wrote in message
news:eO**************@tk2msftngp13.phx.gbl...
The Select event fires when a mouse moves over a menu item
"Devron Blatchford" <de****@auspine.com.au> wrote in message
news:uQ**************@tk2msftngp13.phx.gbl...
Hi there,

I have created an owner draw menu item using DrawItem and MeasureItem in VB.NET. This seems to work well. I was wondering how I can do mouse over effects in these menus. Basically the same as the dot net menus where they get highlighted when the mouse moves over them.

Does anyone have any VB dot net examples or suggestions on how I could do this?

Thanks
Devron



Nov 20 '05 #4

P: n/a
"Devron Blatchford" <de****@auspine.com.au> scripsit:
I have created an owner draw menu item using DrawItem and MeasureItem in
VB.NET. This seems to work well. I was wondering how I can do mouse over
effects in these menus. Basically the same as the dot net menus where they
get highlighted when the mouse moves over them.

Does anyone have any VB dot net examples or suggestions on how I could do
this?


<http://www.msjogren.net/dotnet/eng/samples/dotnet_iconmenu.asp>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #5

P: n/a
> ' /// Inside DrawItem

If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
Else
' The item is not selected, fill with white
End If

'///
For the TopLevel Menus(File, Edit etc...) you may also want to check for
DrawItemState.Hotlight.

' /// Inside DrawItem

If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
ElseIf (e.State And DrawItemState.HotLight) = DrawItemState.Selected Then
'The Item is currently Hot, fill with yellow
Else
' The item is not selected or hot, fill with systemcolors.menu
End If

'///
"Tom Spink" <th**********@ntlworld.com> wrote in message
news:el**************@TK2MSFTNGP12.phx.gbl... Hi Devron, You don't want to be looking at those events, you need to be
using the Draw Item event.

Inside the draw item even, we have the 'e' class (declared as
DrawItemEventArgs) and it allows you to draw the item depending on the state of the item:

' /// Inside DrawItem

If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
Else
' The item is not selected, fill with white
End If

'///

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
"Devron Blatchford" <de****@auspine.com.au> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl...
How do I handle the mouse_leave event to know when the mouse leaves the
item.?

Thanks
Devron
"Stephen" <gr******@bellatlantic.net> wrote in message
news:eO**************@tk2msftngp13.phx.gbl...
The Select event fires when a mouse moves over a menu item
"Devron Blatchford" <de****@auspine.com.au> wrote in message
news:uQ**************@tk2msftngp13.phx.gbl...
> Hi there,
>
> I have created an owner draw menu item using DrawItem and
MeasureItem
in > VB.NET. This seems to work well. I was wondering how I can do mouse over > effects in these menus. Basically the same as the dot net menus
where they
> get highlighted when the mouse moves over them.
>
> Does anyone have any VB dot net examples or suggestions on how I
could do
> this?
>
> Thanks
> Devron
>
>



Nov 20 '05 #6

P: n/a
Hi Mick, slight error in your code:
If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
' /// Slight error ElseIf (e.State And DrawItemState.HotLight) = DrawItemState.Selected Then ' ///
'The Item is currently Hot, fill with yellow
Else
' The item is not selected or hot, fill with systemcolors.menu
End If


It should read

' ///
ElseIf (e.State And DrawItemState.HotLight) = DrawItemState.HotLight Then
' ///

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
"Mick Doherty" <md*******@nospam.ntlworld.com> wrote in message
news:OM**************@TK2MSFTNGP10.phx.gbl...
' /// Inside DrawItem

If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
Else
' The item is not selected, fill with white
End If

'///


For the TopLevel Menus(File, Edit etc...) you may also want to check for
DrawItemState.Hotlight.

' /// Inside DrawItem

If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
ElseIf (e.State And DrawItemState.HotLight) = DrawItemState.Selected Then
'The Item is currently Hot, fill with yellow
Else
' The item is not selected or hot, fill with systemcolors.menu
End If

'///
"Tom Spink" <th**********@ntlworld.com> wrote in message
news:el**************@TK2MSFTNGP12.phx.gbl...
Hi Devron, You don't want to be looking at those events, you need to be
using the Draw Item event.

Inside the draw item even, we have the 'e' class (declared as
DrawItemEventArgs) and it allows you to draw the item depending on the

state
of the item:

' /// Inside DrawItem

If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
Else
' The item is not selected, fill with white
End If

'///

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
"Devron Blatchford" <de****@auspine.com.au> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl...
How do I handle the mouse_leave event to know when the mouse leaves the item.?

Thanks
Devron
"Stephen" <gr******@bellatlantic.net> wrote in message
news:eO**************@tk2msftngp13.phx.gbl...
> The Select event fires when a mouse moves over a menu item
> "Devron Blatchford" <de****@auspine.com.au> wrote in message
> news:uQ**************@tk2msftngp13.phx.gbl...
> > Hi there,
> >
> > I have created an owner draw menu item using DrawItem and MeasureItem
in
> > VB.NET. This seems to work well. I was wondering how I can do
mouse over
> > effects in these menus. Basically the same as the dot net menus

where they
> > get highlighted when the mouse moves over them.
> >
> > Does anyone have any VB dot net examples or suggestions on how I could do
> > this?
> >
> > Thanks
> > Devron
> >
> >
>
>



Nov 20 '05 #7

P: n/a
Well spotted. That's what happens when you cut/paste and edit without
checking.
Of course, had I done this in VS.Net I would have instantly noticed it.

"Tom Spink" <th**********@ntlworld.com> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
Hi Mick, slight error in your code:
If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
' /// Slight error
ElseIf (e.State And DrawItemState.HotLight) = DrawItemState.Selected Then ' ///
'The Item is currently Hot, fill with yellow
Else
' The item is not selected or hot, fill with systemcolors.menu
End If


It should read

' ///
ElseIf (e.State And DrawItemState.HotLight) = DrawItemState.HotLight Then
' ///

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
"Mick Doherty" <md*******@nospam.ntlworld.com> wrote in message
news:OM**************@TK2MSFTNGP10.phx.gbl... ' /// Inside DrawItem

If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
Else
' The item is not selected, fill with white
End If

'///


For the TopLevel Menus(File, Edit etc...) you may also want to check for
DrawItemState.Hotlight.

' /// Inside DrawItem

If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
ElseIf (e.State And DrawItemState.HotLight) = DrawItemState.Selected Then
'The Item is currently Hot, fill with yellow
Else
' The item is not selected or hot, fill with systemcolors.menu
End If

'///
"Tom Spink" <th**********@ntlworld.com> wrote in message
news:el**************@TK2MSFTNGP12.phx.gbl...
Hi Devron, You don't want to be looking at those events, you need to be using the Draw Item event.

Inside the draw item even, we have the 'e' class (declared as
DrawItemEventArgs) and it allows you to draw the item depending on the

state
of the item:

' /// Inside DrawItem

If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
' The item is currently selected, fill with blue
Else
' The item is not selected, fill with white
End If

'///

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
"Devron Blatchford" <de****@auspine.com.au> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl...
> How do I handle the mouse_leave event to know when the mouse leaves

the > item.?
>
> Thanks
> Devron
> "Stephen" <gr******@bellatlantic.net> wrote in message
> news:eO**************@tk2msftngp13.phx.gbl...
> > The Select event fires when a mouse moves over a menu item
> > "Devron Blatchford" <de****@auspine.com.au> wrote in message
> > news:uQ**************@tk2msftngp13.phx.gbl...
> > > Hi there,
> > >
> > > I have created an owner draw menu item using DrawItem and

MeasureItem
in
> > > VB.NET. This seems to work well. I was wondering how I can do mouse over
> > > effects in these menus. Basically the same as the dot net menus

where
> they
> > > get highlighted when the mouse moves over them.
> > >
> > > Does anyone have any VB dot net examples or suggestions on how I

could
> do
> > > this?
> > >
> > > Thanks
> > > Devron
> > >
> > >
> >
> >
>
>



Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.