Visual Studio .NET Style Menu
This is an improvement over "Visual Studio .NET Menu Style" by Carlos H. Perez, that appeared on CodeProject.
I was creating a class in C# to emulate theVS.Net menu, when I came across the original by Carlos, and decide tosave some time and energy by improving on it, rather than starting fromscratch.
This class extends the "MenuItem" class fromthe .Net Framework. Basically it just adds the icon that it is drawn onthe left side and draws the menu item to make it look as close aspossible to the VS Net menus. This class implement owner-draw menus andit is as such bolted on top of the standard windows menu. Thus, it isimpossible to make it identical to the ones that Microsoft is currentlyusing for the VS Net and Office XP Menus. If you are wondering why Inamed the class "SminMenuItem" instead of something like"VSNetMenuItem", thats becuase I was already working on this and hadnamed it SminMenuItem. Feeling too lazy to change all the occurences, Idecided to keep the name.
You just use the constructor to add the nameof the menu, the event handler for the menu, its shortcut and theimage. After that you go about your business of adding a main menu tothe form as you would do it if you were using the standard MenuItem Netimplementation.
// Constructors
// public SminMenuItem(string);
// public SminMenuItem(string, Image);
// public SminMenuItem(string, EventHandler);
// public SminMenuItem(string, EventHandler, Image);
// public SminMenuItem(string, EventHandler, Shortcut);
// public SminMenuItem(string, EventHandler, Shortcut, Image);
Download VSMenuItem.zip
I have tested this only on Windows XP, .Net Framework beta 2.












No comments yet... Be the first to leave a reply!