Click here to Skip to main content
13,555,707 members
Click here to Skip to main content
Add your own
alternative version


51 bookmarked
Posted 2 Dec 2002

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

Sample Image - nicemenu.png


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 always have 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 uses 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

You may also be interested in...

Comments and Discussions

GeneralVB .NET Pin
jadeboy17-Jan-03 1:03
memberjadeboy17-Jan-03 1:03 
Generalsome proplem Pin
chinadeer11-Jan-03 2:32
memberchinadeer11-Jan-03 2:32 
GeneralRe: some proplem Pin
Francesco Natali15-Jan-03 5:46
memberFrancesco Natali15-Jan-03 5:46 
GeneralRe: some proplem Pin
zhuhai16-Dec-03 15:04
memberzhuhai16-Dec-03 15:04 
GeneralRe: some proplem Pin
shinji8111-Oct-04 11:28
membershinji8111-Oct-04 11:28 
GeneralCool But... Pin
houda14-Dec-02 11:34
memberhouda14-Dec-02 11:34 
Generalcool Pin
Jusin3-Dec-02 5:29
memberJusin3-Dec-02 5:29 menu? Pin
rang3r3-Dec-02 3:10
memberrang3r3-Dec-02 3:10 
AnswerRe: .net menu? Pin
Fayez Al-Naddaf3-Dec-02 8:12
memberFayez Al-Naddaf3-Dec-02 8:12 
GeneralRe: .net menu? Pin
Kishorerc23-Dec-02 20:58
memberKishorerc23-Dec-02 20:58 
GeneralRe: .net menu? Pin
Kmaster17-Jan-03 15:48
sussKmaster17-Jan-03 15:48 
GeneralRe: .net menu? Pin
dnh26-Jun-04 11:04
memberdnh26-Jun-04 11:04 

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

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

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