Menus in dialog windows :
This article presents an implementation of an owner drawn menu with the Office XP and Visual Studio .NET visual style.
Using the code
To use the
CMenuXP class in your projects, you have to add 3 macros in your code:
- In the header file of the class that handles the menu (probably the
- In the source file of the same class:
- In the message map of the class:
To make borders flat, I subclass the popup menu window managed by the system. To make it possible, you have to add those 2 calls in your code:
- In the
InitInstance method of your CWinApp derived class:
- In the
ExitInstance method of your CWinApp derived class:
To make the menubar flat, you must do this call:
The best place for this call depends of the frame type:
- For MDI application, into the
OnUpdateFrameMenu method of the child windows.
- For SDI application, into the
LoadFrame method of the main frame.
Finally, don't forget the last call:
Without this call, menus will appear in a standard mode.
To draw the menu items, I reused some classes already presented in my article: Office XP look & feel.
- 02/08/2002 - First release.
- 01/06/2003 - Adding flat borders and flat menubar.
- 05/31/2003 - Kris Wojtas has updated the source code to allow MenuXP to draw "radio", "check" state and gradient under bitmaps.
- 06/02/2003 - Corrections, radio items support (thanks to Kris Wojtas) and new demos (flat controls and dialog based sample). You can get the latest update to this article at www.azsoft.free.fr.
- 14 Jul 03 - further update by Kris: