Click here to Skip to main content
6,595,444 members and growing! (19,282 online)
Email Password   helpLost your password?
Desktop Development » Menus » General     Intermediate

Office 2003 Menus

By Mohammed Halabi

A component to change the look of the menus to that of Office 2003
C#, Windows, .NET 1.1VS.NET2003, Dev
Posted:23 Feb 2004
Views:235,950
Bookmarked:104 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
69 votes for this article.
Popularity: 8.12 Rating: 4.42 out of 5
2 votes, 2.9%
1
3 votes, 4.3%
2
4 votes, 5.8%
3
10 votes, 14.5%
4
50 votes, 72.5%
5

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

About the Author

Mohammed Halabi


Member

Location: Saudi Arabia Saudi Arabia

Other popular Menus articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 81 (Total in Forum: 81) (Refresh)FirstPrevNext
GeneralUpdated Code? Pinmemberkevinlkingma6:06 17 Nov '06  
GeneralGood Control: But..... PinmemberSameers (theAngrycodeR )16:02 22 Oct '06  
GeneralProblem With images in a menu PinmemberIndarjeet0:49 29 Aug '06  
GeneralThe problem about the contextmenu Pinmembersleet_t23:23 12 Dec '05  
GeneralBug Report : Menu Disappears PinmemberMrEyes14:51 27 Nov '05  
QuestionContext Menues PinmemberGolden Dragon13:24 9 Oct '05  
AnswerRe: Context Menues PinmemberJosma0:29 4 May '06  
Generali want to learn program by VC++ Pinmemberthanhvu22:39 4 Oct '05  
Generalhow can a draw a line separator? Pinmemberaxelbrian7:09 8 Sep '05  
GeneralRe: how can a draw a line separator? PinmemberThomas-H.2:34 7 Oct '05  
GeneralUsing MdiList in Menu PinmemberJK_net23:41 3 Jul '05  
GeneralShortcut Display PinmemberDarthVeda3:32 16 Jun '05  
GeneralRe: Shortcut Display PinmemberBalder1978-23:11 4 Sep '05  
GeneralIs there any possibility to use more than one contextmenu per form? Pinmembertgrk6:37 7 Jun '05  
GeneralGreat control, but I have problem with ContextMenus Pinmembertgrk4:45 7 Jun '05  
GeneralRe: Great control, but I have problem with ContextMenus Pinmembertgrk5:58 7 Jun '05  
GeneralContext menu on notify icon PinmemberAlex Matthews1:01 31 May '05  
GeneralRe: Context menu on notify icon PinmemberBalder1978-23:14 4 Sep '05  
GeneralOwner Drawn dynamic content bug PinmemberJoeKau3:01 14 May '05  
GeneralRe: Owner Drawn dynamic content bug PinmemberLiosha23:43 13 Sep '05  
GeneralRe: Owner Drawn dynamic content bug PinmemberJoeKau0:07 14 Sep '05  
GeneralRe: Owner Drawn dynamic content bug PinmemberLiosha2:47 14 Sep '05  
Generalfor hotkey Pinmemberpichamp23:07 10 Mar '05  
GeneralRe: for hotkey PinmemberNguyen Le19:00 23 Mar '05  
GeneralRe: for hotkey PinmemberThomas-H.2:04 24 Mar '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 23 Feb 2004
Editor: Nishant Sivakumar
Copyright 2004 by Mohammed Halabi
Everything else Copyright © CodeProject, 1999-2009
Web22 | Advertise on the Code Project