473,399 Members | 2,858 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,399 software developers and data experts.

Owner draw on the MainMenu and MenuItem

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 redraw the item when the mouse or keyboard has moved
elsewhere. The only thing I could find that semi-worked, was to call an
internal method on the MenuItem object to force a redraw. This works OK for
everything apart from the root level MenuItem. When I try this method on the
root level MenuItem it, for want of a better phrase, spags out and messes up
the painting of the whole form. Not grumbling too much, it is afterall an
internal method.

Anyone know of a way to work with the MainMenu et. al. classes to make them
look nice rather than replacing them?

Cheers,

Tim H
Nov 16 '05 #1
1 3135
You can check the current state of the menuitem by checking e.state for
DrawItemState.Selected and DrawItemState.HotLight. For a complete ownerdraw
MenuItem example take a look at my office style menu class.
http://dotnetrix.co.uk/menus.html

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Tim Haughton" <ti******************@omnibus.SPAMco.uk> wrote in message
news:%d********************@news.easynews.com...
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 redraw the item when the mouse or keyboard has moved
elsewhere. The only thing I could find that semi-worked, was to call an
internal method on the MenuItem object to force a redraw. This works OK for everything apart from the root level MenuItem. When I try this method on the root level MenuItem it, for want of a better phrase, spags out and messes up the painting of the whole form. Not grumbling too much, it is afterall an
internal method.

Anyone know of a way to work with the MainMenu et. al. classes to make them look nice rather than replacing them?

Cheers,

Tim H

---
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
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Piotrek Stachowicz | last post by:
Hi there! I 'd like to customize my main menu a bit (add icons etc.), and 1 questions arose while I was trying to do this: I need to measure the menuitem area, but I don't really know what's the...
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...
2
by: Scott | last post by:
ok, I need to add to a list box each of the items that are in my mainmenu dynamicaly at run time. Due to the structure of adding menu items to menu items I don't see how to do this without...
1
by: VSNT | last post by:
Is there a way to access the painting of a MainMenu so as to change its back color and add icons like i can with MenuItem? Thanks, Allen
1
by: yotaxp | last post by:
I'm trying to create a new menu component, obviously based off of the standard MainMenu/MenuItem components. The designer for the MainMenu component creates MenuItem components for it's child...
1
by: ucasesoftware | last post by:
Hi i create some mainItem with code with this method : AddHandler menuItem.Click, essai_Click As the menuItem is add with code... with a dataReader from a dataBase like : Name1 Name2 Name3 ...
1
by: PogoWolf | last post by:
Hey all, I have a MDI interface going on, with a MainMenu object in the Container Form. The FIRST screen that pops MDI is the 'Login' form. the problem is, the MainMenu is apart of the...
2
by: polocar | last post by:
Hi, I'm writing a program using Visual C# 2005 Professional Edition, and I was trying to assign multiple MainMenu objects (one by one, of course) to the same Form (let's suppose 2 MainMenu...
0
by: genojoe | last post by:
Included below are four methods and a Friend that can be inserted directly into a form that already contains Button1, Button2, and MenuStrip1. Button1 populates the MainMenu control, button2...
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
0
BarryA
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...
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
marktang
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,...
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...

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.