473,411 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Owner Draw Menu Item

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
7 3919
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
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
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
"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
> ' /// 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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Vijaye Raji | last post by:
I am trying to draw the menu-item myself and I've had some success with it. However, when I'm overriding the DrawItem method, the graphics object I get is a couple of pixels offset from the menu -...
1
by: Patty O'Dors | last post by:
Hi I have some code to create an ownerdrawn listbox (derived), and when I add an item to it, the bold text of the first item (the title, 'Collections and Maturities') mysteriously seems to get...
1
by: Tim Haughton | last post by:
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....
0
by: John R. | last post by:
I want to add a textbox next to each item in a Listbox on a Windows Form. The items need to be scrollable so I thought that maybe this is possible with an Owner Draw listbox. Searching the web...
1
by: Robin Tucker | last post by:
Hi ppl, My owner draw list box controls do not "refresh" old selected items when a new selection is made. This means that as you click to make selections, the previously selected items stay...
2
by: dan heskett | last post by:
I am owner-drawing a listbox, in an attempt to create a nice list with some custom "fields" and text layout. Essentially it works, but I must be missing something big, conceptually, because I...
0
by: Smokey Grindle | last post by:
This is just a wierd one... I am trying to draw the sub items in the drawitem event of the list view in owner drawn mode (because of documented W32 rendering bugs) instead of in two seperate items...
1
by: liubin | last post by:
I'm trying to create a context menu that pops up upon right clicking the notify icon of my application. The menu works great with plain text... no problem. My problem is that I want to add some...
0
by: LostInMd | last post by:
Hi All, I've got an owner drawn listBox where I draw and measure the items that I add to the listBox. For example, I have a listBox that can only display 10 characters on each horizontal line. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.