
Introduction
Just with one Single Line of code, you can change the look of all Menus and
Context menus of your Windows Forms Project to look just like the menus shipped
with Office 2003. Also, you can add Icons to your menus with a single line of
code. There is one more feature in this component, You can simple call the
method End to change the menus to its original look.
Using the code
To use the Component, First, add the component to the Toolbox, and then drag
it to the form, and then just call this Method:
OfficeMenus1.Start( FormName );
Also, you can change the look of the menus to its original look by calling
this method:
OfficeMenus1.End();
Adding Icons to Menu Items is very simple, Just add an ImageList to your
project, and then change the ImageList property of your OfficeMenu Component to
the ImageList you wish to use, and then use this code:
OfficeMenus1.ImageList = imageList1;
OfficeMenus1.AddPicture(menuItem2, 1);
Points of Interest
I was so confused about the way i will add pictures to menus, so i decided to
add a collection of type NameValueCollection, and when we call the method
AddPicture it will add the Handle of the menu and the Image index to that
Collection, and when we want to retrieve the image of a menu, we search this
collection for the handle of the menu, if found it returns the picture,
otherwise it returns null. Check the code for more information. BTW, the code is
well commented.