Click here to Skip to main content
11,645,499 members (74,976 online)
Click here to Skip to main content

Office 2003 Menus

, 23 Feb 2004 288.9K 1.2K 113
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

You may also be interested in...

Comments and Discussions

 
QuestionLicense terms Pin
Rotted Frog12-Nov-12 1:18
memberRotted Frog12-Nov-12 1:18 
QuestionUpdated Code? Pin
kevinlkingma17-Nov-06 5:06
memberkevinlkingma17-Nov-06 5:06 
GeneralGood Control: But..... Pin
Sameers (theAngrycodeR )22-Oct-06 15:02
memberSameers (theAngrycodeR )22-Oct-06 15:02 
Very Nice contol. Quick and easy to use, but limited in some functionalties for example, context menu, tray icon menu etc. Also, once you have called the Start method, there is no way to change icon of menu item.

I had two context menus which are associated with controls dynamically. When I called Start method, it didn't applied theme on them, even I tried with associated ContextMenu with controls (ListView) before calling it, but didn't worked. however, when I assigedn one context menu to form itself, it worked.

IF this control has support for Context Menu and runtime image updation, then i think this will be the best one. I think to change icons at runtime, there is one 'tweak' (Just thought about while writing this message), that is, stop and start it again. I believe it should work. Will test now.

But ***** from me. Since this is really best effort.
Good Luck
Sameers

Need custom software? Contact DevelopersINN[^]
Need to add reminders for your Outlook emails? Try Outlook Personal Assistant[^]

GeneralProblem With images in a menu Pin
Indarjeet28-Aug-06 23:49
memberIndarjeet28-Aug-06 23:49 
GeneralThe problem about the contextmenu Pin
sleet_t12-Dec-05 22:23
membersleet_t12-Dec-05 22:23 
GeneralBug Report : Menu Disappears Pin
MrEyes27-Nov-05 13:51
memberMrEyes27-Nov-05 13:51 
QuestionContext Menues Pin
Golden Dragon9-Oct-05 12:24
memberGolden Dragon9-Oct-05 12:24 
AnswerRe: Context Menues Pin
Josma3-May-06 23:29
memberJosma3-May-06 23:29 
Generali want to learn program by VC++ Pin
thanhvu4-Oct-05 21:39
memberthanhvu4-Oct-05 21:39 
Questionhow can a draw a line separator? Pin
axelbrian8-Sep-05 6:09
memberaxelbrian8-Sep-05 6:09 
AnswerRe: how can a draw a line separator? Pin
Thomas-H.7-Oct-05 1:34
memberThomas-H.7-Oct-05 1:34 
GeneralUsing MdiList in Menu Pin
JK_net3-Jul-05 22:41
memberJK_net3-Jul-05 22:41 
GeneralShortcut Display Pin
DarthVeda16-Jun-05 2:32
memberDarthVeda16-Jun-05 2:32 
GeneralRe: Shortcut Display Pin
Balder1978-24-Sep-05 2:11
memberBalder1978-24-Sep-05 2:11 
QuestionIs there any possibility to use more than one contextmenu per form? Pin
tgrk7-Jun-05 5:37
membertgrk7-Jun-05 5:37 
GeneralGreat control, but I have problem with ContextMenus Pin
tgrk7-Jun-05 3:45
membertgrk7-Jun-05 3:45 
GeneralRe: Great control, but I have problem with ContextMenus Pin
tgrk7-Jun-05 4:58
membertgrk7-Jun-05 4:58 
GeneralContext menu on notify icon Pin
Alex Matthews31-May-05 0:01
memberAlex Matthews31-May-05 0:01 
GeneralRe: Context menu on notify icon Pin
Balder1978-24-Sep-05 2:14
memberBalder1978-24-Sep-05 2:14 
GeneralOwner Drawn dynamic content bug Pin
JoeKau14-May-05 2:01
memberJoeKau14-May-05 2:01 
GeneralRe: Owner Drawn dynamic content bug Pin
Liosha13-Sep-05 22:43
memberLiosha13-Sep-05 22:43 
GeneralRe: Owner Drawn dynamic content bug Pin
JoeKau13-Sep-05 23:07
memberJoeKau13-Sep-05 23:07 
GeneralRe: Owner Drawn dynamic content bug Pin
Liosha14-Sep-05 1:47
memberLiosha14-Sep-05 1:47 
Generalfor hotkey Pin
pichamp10-Mar-05 22:07
memberpichamp10-Mar-05 22:07 
GeneralRe: for hotkey Pin
Nguyen Le23-Mar-05 18:00
memberNguyen Le23-Mar-05 18:00 
GeneralRe: for hotkey Pin
Thomas-H.24-Mar-05 1:04
memberThomas-H.24-Mar-05 1:04 
GeneralRe: for hotkey Pin
Nguyen Le24-Mar-05 5:10
memberNguyen Le24-Mar-05 5:10 
GeneralRe: for hotkey Pin
Thomas-H.28-Mar-05 21:50
memberThomas-H.28-Mar-05 21:50 
GeneralRe: for hotkey Pin
amoba22-Sep-05 3:19
memberamoba22-Sep-05 3:19 
GeneralRe: for hotkey Pin
charliedurrant9-Nov-05 3:39
membercharliedurrant9-Nov-05 3:39 
GeneralRe: for hotkey Pin
Balder1978-24-Sep-05 2:20
memberBalder1978-24-Sep-05 2:20 
GeneralRe: for hotkey Pin
Danny DB28-Sep-05 1:43
memberDanny DB28-Sep-05 1:43 
GeneralTo add the hotkey when you prefix a leffer by '&' Pin
andrei_t325-Jul-07 23:42
memberandrei_t325-Jul-07 23:42 
GeneralI discovers this website is very slow Pin
qihontin1-Mar-05 18:29
memberqihontin1-Mar-05 18:29 
Generalit throws an error. Pin
Pyro Joe30-Dec-04 6:00
memberPyro Joe30-Dec-04 6:00 
GeneralRe: it throws an error. Pin
Pyro Joe30-Dec-04 6:44
memberPyro Joe30-Dec-04 6:44 
Questionwhere do you the find the OfficeMenus object? Pin
Pyro Joe30-Dec-04 5:48
memberPyro Joe30-Dec-04 5:48 
AnswerRe: where do you the find the OfficeMenus object? Pin
Pyro Joe30-Dec-04 6:03
memberPyro Joe30-Dec-04 6:03 
AnswerRe: where do you the find the OfficeMenus object? Pin
spvarapu30-Apr-05 21:51
memberspvarapu30-Apr-05 21:51 
GeneralNested controls bug and a solution Pin
horvatma16-Dec-04 0:14
memberhorvatma16-Dec-04 0:14 
GeneralRe: Nested controls bug and a solution Pin
ddi_soft21-Mar-05 11:11
memberddi_soft21-Mar-05 11:11 
GeneralRe: Nested controls bug and a solution Pin
Rasta Man5-Apr-05 18:04
memberRasta Man5-Apr-05 18:04 
GeneralRe: Nested controls bug and a solution Pin
vutrunghieu31-Jul-05 6:03
membervutrunghieu31-Jul-05 6:03 
QuestionIs Bug? Pin
feitian7812-Nov-04 17:41
memberfeitian7812-Nov-04 17:41 
AnswerRe: Is Bug? Pin
Supergoal8-Apr-05 4:15
memberSupergoal8-Apr-05 4:15 
GeneralBug?! No Menu -> no Office 2003 for ContextMenu Pin
snoova the wookie27-Oct-04 6:02
membersnoova the wookie27-Oct-04 6:02 
GeneralThanks for your control Pin
XTV3-Sep-04 0:28
memberXTV3-Sep-04 0:28 
GeneralSeperators not visible Pin
umair8215-Aug-04 7:42
memberumair8215-Aug-04 7:42 
GeneralRe: Separators not visible Pin
Alexander German15-Nov-04 4:56
memberAlexander German15-Nov-04 4:56 
GeneralMDI support Pin
uTILLIty13-Aug-04 3:07
memberuTILLIty13-Aug-04 3:07 

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