473,779 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3943
The Select event fires when a mouse moves over a menu item
"Devron Blatchford" <de****@auspine .com.au> wrote in message
news:uQ******** ******@tk2msftn gp13.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******@bella tlantic.net> wrote in message
news:eO******** ******@tk2msftn gp13.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******** ******@tk2msftn gp13.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
DrawItemEventAr gs) and it allows you to draw the item depending on the state
of the item:

' /// Inside DrawItem

If (e.State And DrawItemState.S elected) = DrawItemState.S elected 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.Reflecti on Master "

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

Thanks
Devron
"Stephen" <gr******@bella tlantic.net> wrote in message
news:eO******** ******@tk2msftn gp13.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******** ******@tk2msftn gp13.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.ne t/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.S elected) = DrawItemState.S elected 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.H otlight.

' /// Inside DrawItem

If (e.State And DrawItemState.S elected) = DrawItemState.S elected Then
' The item is currently selected, fill with blue
ElseIf (e.State And DrawItemState.H otLight) = DrawItemState.S elected Then
'The Item is currently Hot, fill with yellow
Else
' The item is not selected or hot, fill with systemcolors.me nu
End If

'///
"Tom Spink" <th**********@n tlworld.com> wrote in message
news:el******** ******@TK2MSFTN GP12.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
DrawItemEventAr gs) and it allows you to draw the item depending on the state of the item:

' /// Inside DrawItem

If (e.State And DrawItemState.S elected) = DrawItemState.S elected 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.Reflecti on Master "

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

Thanks
Devron
"Stephen" <gr******@bella tlantic.net> wrote in message
news:eO******** ******@tk2msftn gp13.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******** ******@tk2msftn gp13.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.S elected) = DrawItemState.S elected Then
' The item is currently selected, fill with blue
' /// Slight error ElseIf (e.State And DrawItemState.H otLight) = DrawItemState.S elected Then ' ///
'The Item is currently Hot, fill with yellow
Else
' The item is not selected or hot, fill with systemcolors.me nu
End If


It should read

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

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

Please respond to the newsgroup,
so all can benefit

" System.Reflecti on Master "

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

If (e.State And DrawItemState.S elected) = DrawItemState.S elected 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.H otlight.

' /// Inside DrawItem

If (e.State And DrawItemState.S elected) = DrawItemState.S elected Then
' The item is currently selected, fill with blue
ElseIf (e.State And DrawItemState.H otLight) = DrawItemState.S elected Then
'The Item is currently Hot, fill with yellow
Else
' The item is not selected or hot, fill with systemcolors.me nu
End If

'///
"Tom Spink" <th**********@n tlworld.com> wrote in message
news:el******** ******@TK2MSFTN GP12.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
DrawItemEventAr gs) and it allows you to draw the item depending on the

state
of the item:

' /// Inside DrawItem

If (e.State And DrawItemState.S elected) = DrawItemState.S elected 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.Reflecti on Master "

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

Thanks
Devron
"Stephen" <gr******@bella tlantic.net> wrote in message
news:eO******** ******@tk2msftn gp13.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******** ******@tk2msftn gp13.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**********@n tlworld.com> wrote in message
news:ua******** ******@TK2MSFTN GP12.phx.gbl...
Hi Mick, slight error in your code:
If (e.State And DrawItemState.S elected) = DrawItemState.S elected Then
' The item is currently selected, fill with blue
' /// Slight error
ElseIf (e.State And DrawItemState.H otLight) = DrawItemState.S elected Then ' ///
'The Item is currently Hot, fill with yellow
Else
' The item is not selected or hot, fill with systemcolors.me nu
End If


It should read

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

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

Please respond to the newsgroup,
so all can benefit

" System.Reflecti on Master "

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

If (e.State And DrawItemState.S elected) = DrawItemState.S elected 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.H otlight.

' /// Inside DrawItem

If (e.State And DrawItemState.S elected) = DrawItemState.S elected Then
' The item is currently selected, fill with blue
ElseIf (e.State And DrawItemState.H otLight) = DrawItemState.S elected Then
'The Item is currently Hot, fill with yellow
Else
' The item is not selected or hot, fill with systemcolors.me nu
End If

'///
"Tom Spink" <th**********@n tlworld.com> wrote in message
news:el******** ******@TK2MSFTN GP12.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
DrawItemEventAr gs) and it allows you to draw the item depending on the

state
of the item:

' /// Inside DrawItem

If (e.State And DrawItemState.S elected) = DrawItemState.S elected 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.Reflecti on Master "

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

the > item.?
>
> Thanks
> Devron
> "Stephen" <gr******@bella tlantic.net> wrote in message
> news:eO******** ******@tk2msftn gp13.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******** ******@tk2msftn gp13.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
1002
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 - which means, when I do a FillRectangle on the Bounds of the item, I still get a thin "Control colored" border around the item. Is there a way to get around it? Thanks, VJ
1
2893
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 bunched up at the right, i.e. squashed up! any idea why? The main bit of the code is as such // (in progressReporter.cs) protected struct LBRow //a row of the listbox, whether it be the title or a
1
3181
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. 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...
0
1815
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 and newsgroups I don't find an example anywhere how I could add a textbox or other control to an Owner Draw listbox. Can someone show me how I'd add a textbox to each listbox item using an Owner Draw listbox?
1
3569
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 highlighted along with the new ones too. It draws correctly when I minimize the window and then maximise it again, but I just don't seem to be getting a "DrawItem" event for switching of an item from Selected to NotSelected! Any ideas??? Here is...
2
3137
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 get all kinds of screen artifacts and weirdness. My general goal is: list item with a few areas for text, every other item shaded a light color for readability, font color changes with selection. The listbox is populated with custom structurs...
0
2287
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 drawitem and drawsubitems... but when I run this code in the drawitems For Each subItm As ListViewItem.ListViewSubItem In _tn.SubItems ' If subItm..ColumnIndex <0 Then 'If (e.State And Windows.Forms.ListViewItemStates.Selected) = 1 Then
1
1940
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 sparkle by displaying a different highlighting scheme for the individual mouse over events and an icon on each item in the menu. I can do this, and have successfully done this in a regular main menu and a context menu that is set to an item on a...
0
2689
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. The majority of my items contain much more than 10 characters and thus the reason for my use of owner drawn listBoxes - I do not want to use a horizontal scrollbar, instead I want the text of each item to wrap onto multiple lines. I do use a...
0
10138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9930
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7485
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.