Click here to Skip to main content
Click here to Skip to main content

Office 2003 Menus

, 23 Feb 2004
Rate this:
Please Sign up or sign in to vote.
A component to change the look of the menus to that of Office 2003

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:

// To start showing the Office 2003 Menus
OfficeMenus1.Start( FormName );

Also, you can change the look of the menus to its original look by calling this method:

// to change the look of the menus to its original "classic" look
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:

// Adding a picture to your Menus
// OfficeMenus.AddPicture( MenuItem MenuItemToAddPictureTo, int ImageIndex );
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.

License

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

Share

About the Author

Mohammed Halabi

Saudi Arabia Saudi Arabia
No Biography provided

Comments and Discussions

 
QuestionLicense terms PinmemberRotted Frog12-Nov-12 2:18 
QuestionUpdated Code? Pinmemberkevinlkingma17-Nov-06 6:06 
GeneralGood Control: But..... PinmemberSameers (theAngrycodeR )22-Oct-06 16:02 
GeneralProblem With images in a menu PinmemberIndarjeet29-Aug-06 0:49 
GeneralThe problem about the contextmenu Pinmembersleet_t12-Dec-05 23:23 
GeneralBug Report : Menu Disappears PinmemberMrEyes27-Nov-05 14:51 
QuestionContext Menues PinmemberGolden Dragon9-Oct-05 13:24 
AnswerRe: Context Menues PinmemberJosma4-May-06 0:29 
Generali want to learn program by VC++ Pinmemberthanhvu4-Oct-05 22:39 
Questionhow can a draw a line separator? Pinmemberaxelbrian8-Sep-05 7:09 
how can a draw a line separator?
AnswerRe: how can a draw a line separator? PinmemberThomas-H.7-Oct-05 2:34 
GeneralUsing MdiList in Menu PinmemberJK_net3-Jul-05 23:41 
GeneralShortcut Display PinmemberDarthVeda16-Jun-05 3:32 
GeneralRe: Shortcut Display PinmemberBalder1978-24-Sep-05 3:11 
QuestionIs there any possibility to use more than one contextmenu per form? Pinmembertgrk7-Jun-05 6:37 
GeneralGreat control, but I have problem with ContextMenus Pinmembertgrk7-Jun-05 4:45 
GeneralRe: Great control, but I have problem with ContextMenus Pinmembertgrk7-Jun-05 5:58 
GeneralContext menu on notify icon PinmemberAlex Matthews31-May-05 1:01 
GeneralRe: Context menu on notify icon PinmemberBalder1978-24-Sep-05 3:14 
GeneralOwner Drawn dynamic content bug PinmemberJoeKau14-May-05 3:01 
GeneralRe: Owner Drawn dynamic content bug PinmemberLiosha13-Sep-05 23:43 
GeneralRe: Owner Drawn dynamic content bug PinmemberJoeKau14-Sep-05 0:07 
GeneralRe: Owner Drawn dynamic content bug PinmemberLiosha14-Sep-05 2:47 
Generalfor hotkey Pinmemberpichamp10-Mar-05 23:07 
GeneralRe: for hotkey PinmemberNguyen Le23-Mar-05 19:00 

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
Web02 | 2.8.1411023.1 | Last Updated 24 Feb 2004
Article Copyright 2004 by Mohammed Halabi
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid