Click here to Skip to main content
11,412,833 members (75,636 online)
Click here to Skip to main content

Improvement of the .NET Menu Style class

, 14 Jan 2003
Rate this:
Please Sign up or sign in to vote.
This is an improvement by Francesco Natali over an improvement by Sajith M of the "Visual Studio .NET Menu Style" by Carlos H. Perez
<!-- Article image -->

Sample Image - nicemenu.png

<!-- Add the rest of your HTML here -->


With this new ".NET Menu Style" class you can get a great menu with only few lines of code. You don't have to write a line of code for each menu item because your menu now will be AUTOMATICALLY updated! This is very useful, 'cause now you can still build and update your menu with the VS.NET tool, but at runtime you'll have always a new fresh .NET style menu. Another improvement is about the menu images, now you can use a simple imagelist to store your icon, and with a line of code and a simple trick (to add the index of the image near the text of the menu item), you'll get your image near your menu item.

I've updated this class, now you can use icons with context menu and search for a MenuItem at runtime with an easy function. Now you can also download a nice RTF file editor that use the .NET style menu. This RTF file editor is still under development, however it's already a good example of C# programming.

Using the code

You have to add:

using Utility.NiceMenu;

and after the "InitializeComponent()" code:

NiceMenu myNiceMenu = new NiceMenu();
    new NiceMenuClickEvent(nameofyourclickfunction));

If you want to add some incons in your menu you have to:

  • add an imagelist control in your form
  • add your icons in your imagelist control
  • add in your menu items the index of the icon in the first two characters. For example:
    • 00New
    • 01Open
    • 02Close
  • After the NiceMenu myNiceMenu = new NiceMenu(); code you have to add this simple line of code:
myNiceMenu.imgMenu = nameofyourimagelist; 

Points of Interest

There are a lot of comments with the code, so... enjoy!


This is an improvement by Francesco Natali over an improvement by Sajith M of the "Visual Studio .NET Menu Style" by Carlos H. Perez


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Francesco Natali
Web Developer
Italy Italy
No Biography provided

Comments and Discussions

GeneralGreat tool. Beware if you re using multiple context menues Pin
anton_fernando at 25-Jun-07 11:29
memberanton_fernando25-Jun-07 11:29 
GeneralConverting to Visual Studio 2005 ToolStripMenuItem Pin
Veeran Kutty at 31-Jan-06 8:38
memberVeeran Kutty31-Jan-06 8:38 
GeneralConvenient click handler for menu Pin
CoreyRIT at 6-Jan-06 8:58
memberCoreyRIT6-Jan-06 8:58 
GeneralRe: Convenient click handler for menu Pin
anton_fernando at 23-May-06 10:55
memberanton_fernando23-May-06 10:55 
GeneralAdding a Windows Form to a menu Pin
Jim Barber at 27-Aug-05 20:18
memberJim Barber27-Aug-05 20:18 
AnswerRe: Adding a Windows Form to a menu Pin
illium at 31-Jul-06 19:45
memberillium31-Jul-06 19:45 
Generalsubmenu arrow Pin
SoTTo at 27-Jun-05 5:45
memberSoTTo27-Jun-05 5:45 
QuestionMC++ ? Pin
CppBeginner at 9-Oct-04 1:55
memberCppBeginner9-Oct-04 1:55 
QuestionEnabled works?? Pin
mpwt at 17-Sep-04 1:58
membermpwt17-Sep-04 1:58 
Generalvery nice tool Pin
sherb at 13-Sep-04 3:19
membersherb13-Sep-04 3:19 
GeneralRe: very nice tool Pin
Anonymous at 14-Apr-05 19:04
sussAnonymous14-Apr-05 19:04 
QuestionHow can I set the submenuItem's Checked Status? Pin
hanll at 4-Jul-04 23:34
memberhanll4-Jul-04 23:34 
AnswerRe: How can I set the submenuItem's Checked Status? Pin
hanll at 5-Jul-04 0:27
memberhanll5-Jul-04 0:27 
GeneralThanks Pin
sfalong at 25-Mar-04 3:46
membersfalong25-Mar-04 3:46 
GeneralIcon resources Pin
PPPDev at 9-Jan-04 6:57
memberPPPDev9-Jan-04 6:57 
QuestionWhat does ModifyRegistry does? Pin
azusakt at 23-Oct-03 18:49
memberazusakt23-Oct-03 18:49 
QuestionMDIList feature lost? Pin
pingdee at 22-Oct-03 9:18
memberpingdee22-Oct-03 9:18 
GeneralHotkeyPrefix Pin
lagay at 8-Sep-03 13:53
memberlagay8-Sep-03 13:53 
GeneralContext Menu and CloneMenu Method Pin at 22-Aug-03 10:12
membermarianod2@hotmail.com22-Aug-03 10:12 
GeneralOffice 2003 Menu Style Pin
8MX at 10-Apr-03 11:48
member8MX10-Apr-03 11:48 have just released their Office 2003 Menu Style.
As we here look for free stuff, how about updating this great menu with Office 2003 style ?
Rose | [Rose] Blush | :O

GeneralRe: Office 2003 Menu Style Pin
Ray Cassick at 10-Apr-03 12:48
memberRay Cassick10-Apr-03 12:48 
GeneralBad Code Pin
TemplMetaProg at 28-Mar-03 2:38
memberTemplMetaProg28-Mar-03 2:38 
GeneralRe: Bad Code Pin
.S.Rod. at 28-Mar-03 2:58
member.S.Rod.28-Mar-03 2:58 
GeneralEqual Menuitem Name Pin
mveiga at 23-Jan-03 17:37
membermveiga23-Jan-03 17:37 
GeneralRe: Equal Menuitem Name Pin
lonelywind1982 at 6-Apr-06 18:33
memberlonelywind19826-Apr-06 18:33 
GeneralVB .NET Pin
jadeboy at 17-Jan-03 2:03
memberjadeboy17-Jan-03 2:03 
Generalsome proplem Pin
chinadeer at 11-Jan-03 3:32
memberchinadeer11-Jan-03 3:32 
GeneralRe: some proplem Pin
Francesco Natali at 15-Jan-03 6:46
memberFrancesco Natali15-Jan-03 6:46 
GeneralRe: some proplem Pin
zhuhai at 16-Dec-03 16:04
memberzhuhai16-Dec-03 16:04 
GeneralRe: some proplem Pin
shinji81 at 11-Oct-04 12:28
membershinji8111-Oct-04 12:28 
GeneralCool But... Pin
houda at 14-Dec-02 12:34
memberhouda14-Dec-02 12:34 
Generalcool Pin
Jusin at 3-Dec-02 6:29
memberJusin3-Dec-02 6:29 menu? Pin
rang3r at 3-Dec-02 4:10
memberrang3r3-Dec-02 4:10 
AnswerRe: .net menu? Pin
Fayez Al-Naddaf at 3-Dec-02 9:12
memberFayez Al-Naddaf3-Dec-02 9:12 
GeneralRe: .net menu? Pin
Kishorerc at 23-Dec-02 21:58
memberKishorerc23-Dec-02 21:58 
GeneralRe: .net menu? Pin
Kmaster at 17-Jan-03 16:48
sussKmaster17-Jan-03 16:48 
GeneralRe: .net menu? Pin
dnh at 26-Jun-04 12:04
memberdnh26-Jun-04 12:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150427.1 | Last Updated 15 Jan 2003
Article Copyright 2002 by Francesco Natali
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid