Hi there!
I have successfully create my own ownerdrawn menus.
However, I decided to add some code for the menus to detect if their parent
is a MainMenu object and, if it is, as it is the menuitem beeing displayed
in the form's menu bar, it draws it differently.
So far so good.
But there are two thing I can't get around.
1 - How can I draw a custom menu when the mouse is over the menu item but
the user hasn't clicked it, just like in Visual Studio or Office 2003?
2 - When the user clicks the menu item, its design changes. However, when
the user moves to another menu (from file to edit, for instance) or when it
closes the menu, it will not redraw. The menu bar will be as if all the menu
items are beeing clicked at the same time.
Any help would be appreciated.
Thank you in advance.
André Nogueira 3 1248
You need to draw different States and erase the previous state.
Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
MyBase.OnPaint(e)
'Erase Previous State
e.Graphics.FillRectangle(BackcolorBrush, e.Bounds)
If CBool(e.State And DrawItemState.Selected) Or _
CBool(e.State And DrawItemState.HotLight) Then
'Hilighted Item Painting Here
Else
'Normal Item Painting here
End If
End Sub http://dotnetrix.co.uk/menus.html --> Office style Menu
--
Mick Doherty http://dotnetrix.co.uk/nothing.html
"André Nogueira" <an**@netcabo.pt.NOSPAM> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl... Hi there! I have successfully create my own ownerdrawn menus. However, I decided to add some code for the menus to detect if their
parent is a MainMenu object and, if it is, as it is the menuitem beeing displayed in the form's menu bar, it draws it differently. So far so good. But there are two thing I can't get around.
1 - How can I draw a custom menu when the mouse is over the menu item but the user hasn't clicked it, just like in Visual Studio or Office 2003?
2 - When the user clicks the menu item, its design changes. However, when the user moves to another menu (from file to edit, for instance) or when
it closes the menu, it will not redraw. The menu bar will be as if all the
menu items are beeing clicked at the same time.
Any help would be appreciated. Thank you in advance.
André Nogueira
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004
You need to draw different States and erase the previous state.
Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
MyBase.OnPaint(e)
'Erase Previous State
e.Graphics.FillRectangle(BackcolorBrush, e.Bounds)
If CBool(e.State And DrawItemState.Selected) Or _
CBool(e.State And DrawItemState.HotLight) Then
'Hilighted Item Painting Here
Else
'Normal Item Painting here
End If
End Sub http://dotnetrix.co.uk/menus.html --> Office style Menu
--
Mick Doherty http://dotnetrix.co.uk/nothing.html
"André Nogueira" <an**@netcabo.pt.NOSPAM> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl... Hi there! I have successfully create my own ownerdrawn menus. However, I decided to add some code for the menus to detect if their
parent is a MainMenu object and, if it is, as it is the menuitem beeing displayed in the form's menu bar, it draws it differently. So far so good. But there are two thing I can't get around.
1 - How can I draw a custom menu when the mouse is over the menu item but the user hasn't clicked it, just like in Visual Studio or Office 2003?
2 - When the user clicks the menu item, its design changes. However, when the user moves to another menu (from file to edit, for instance) or when
it closes the menu, it will not redraw. The menu bar will be as if all the
menu items are beeing clicked at the same time.
Any help would be appreciated. Thank you in advance.
André Nogueira
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004
The Office 2003 style is what I am doing ;)
It's nearly done!
Thank you for your help
André Nogueira
"Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:uR**************@TK2MSFTNGP12.phx.gbl... You need to draw different States and erase the previous state.
Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs) MyBase.OnPaint(e)
'Erase Previous State e.Graphics.FillRectangle(BackcolorBrush, e.Bounds)
If CBool(e.State And DrawItemState.Selected) Or _ CBool(e.State And DrawItemState.HotLight) Then 'Hilighted Item Painting Here Else 'Normal Item Painting here End If
End Sub
http://dotnetrix.co.uk/menus.html --> Office style Menu
-- Mick Doherty http://dotnetrix.co.uk/nothing.html
"André Nogueira" <an**@netcabo.pt.NOSPAM> wrote in message news:Oc**************@TK2MSFTNGP09.phx.gbl... Hi there! I have successfully create my own ownerdrawn menus. However, I decided to add some code for the menus to detect if their parent is a MainMenu object and, if it is, as it is the menuitem beeing
displayed in the form's menu bar, it draws it differently. So far so good. But there are two thing I can't get around.
1 - How can I draw a custom menu when the mouse is over the menu item
but the user hasn't clicked it, just like in Visual Studio or Office 2003?
2 - When the user clicks the menu item, its design changes. However,
when the user moves to another menu (from file to edit, for instance) or when it closes the menu, it will not redraw. The menu bar will be as if all the menu items are beeing clicked at the same time.
Any help would be appreciated. Thank you in advance.
André Nogueira
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Martin Streller |
last post by:
Hello,
The code below represents a simple ownerdrawn,
Listview class in C#. Its purpose is to avoid
the flicker of the MS ListView. So I can't fall
back to their one.
Does anybody know why I...
|
by: Beeeeeeeeeeeeves |
last post by:
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with...
|
by: Beeeeeeeeeeeeves |
last post by:
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with...
|
by: Andrew Baker |
last post by:
Have a look at the code below. It's a really simple example where I
have added two controls to a form, a textbox and a combo box. Both add
owner drawn context menus to the controls, but the...
|
by: Dave |
last post by:
Does anyone have a simple example of setting up an ownerdrawn statusbarpanel
control in c++ .NET?
It would be greatly appreciated.
Thanks
Dave
|
by: Danny van Kasteel |
last post by:
Hi,
I'm having some trouble drawing items in controls that I've marked as
ownerdrawn.
I'm currently developing an application that has ownerdrawn statusbar
panels, and a listbox that contains...
|
by: Andre Nogueira |
last post by:
Hi there.
I have created a Windows Control Library project within my solution (using
VB.Net 2003) and created a control which inherits the MenuItem class but
takes cares of the drawing of the...
|
by: Dino Buljubasic |
last post by:
Hi,
My application has a menu with some of the menu items that have their
own menu items. By default, VB will add a black right rectangle when
a menu items has its own menu items.
However,...
|
by: Ufit |
last post by:
Is there any free resource editor with full visual support
for creating dialogs and controlls? I came across a particular problem
when creating menu - it is impossible to assign IDs to popup items...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
| |