Get the Office 2003 style menus/toolbars in your MFC apps using Windows Forms

This is my latest Code Project article, and it shows you how to use the Windows Forms 2.0 MenuStrip and ToolStrip controls in your MFC applications to give them an Office 2003 look and feel. These Forms controls are pretty well written, and if you change the XP theme/style, they change accordingly, just like Word or Excel would!

Advertisements

5 thoughts on “Get the Office 2003 style menus/toolbars in your MFC apps using Windows Forms

  1. [this is a copy of my comment in Code Project]
    Hi Nish,
    Thanks for the article.

    It seems that the menu does not respond to any accelerator/access keys (ALT+…) even when modifying the code to assign accelerators to menu items (by adding “&” before the desired key).
    Interestingly, once a menu is open, it responds to key strokes that are assigned to the old “default” main menu.

    Moreover, the application responds to shortcut keys which weren’t assigned in the new MenuStrip instance.
    For example, run the demo application and hit CTRL+P – It will open the Print dialog box. This is a result of the Accelerator definitions in the resource file and since the MenuStrip has its own support for shortcut keys, I guess it’s something to keep in mind while approaching shortcut keys support, in order to avoid collisions.

    Thanks,
    Ronen.

  2. Hello Ronen,

    Yep, I did see your comment. I was too busy the last week, and didn’t find time to look into that yet. Sorry about that. I don’t know when I’ll be able to look into it – but I believe it will involve rerouting the shortcut keys to the .NET menu so that it can handle it accordingly.

    Nish

  3. Hi Nish,

    This would be really useful for sprucing up many MFC/SDI apps, but unfortunately isn’t really complete without access keys. As Ronen says the old style accelerators still work – maybe if those handlers could somehow programatically ‘click’ the top level menu so that its sub-items were displayed, and then maybe some owner-draw painting to display the ‘underline’ character.

    Sounds easy enough, but I haven’t been able to make it do so yet. Which is a shame, because this could be a really useful approach.

    Thanks anyway,

    Duncan.

  4. Hi Nish,

    I was browsing for tutorial for Creation of a Word 2007 document using the Open XML Format SDK using C++/CLI and was futile in finding any..
    Can you please write an article or a simple tutorial in creating .docx files using OpenXML SDK in C++/CLI. Thought many would benefit from this including me.

    Ragards
    Athreya Raghu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s