article presents an implementation of an owner
drawn menu with the Office
XP and Visual Studio .NET visual style. It
has icon menu and bitmap
menu feature, it uses CMenu
as base class.
To use the
menu class in your
projects, you have to add 3 macros in your code:
header file of the class that handles the menu
#include "Tools/MenuXP.h" // Before the declaration of the class
DECLARE_MENUXP() // Into the definition of the class
source file of the same class:
message map of the class:
ON_MENUXP_MESSAGES() // <-- Added line
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:
InitInstance method of your CWinApp
ExitInstance method of your CWinApp
the menubar flat, you must do this call:
CMenuXP::UpdateMenuBar (pFrameWnd); // pFrameWnd refers to the frame that
// contains the MenuBar
place for this call depends of the frame type:
MDI application, into the
method of the child windows.
SDI application, into the
method of the main frame.
don't forget the last call:
CMenuXP::SetXPLookNFeel (pFrameWnd); // refers to the frame that contains
// the MenuBar
this call, menus will appear in a standard mode.
the menu items, I reused some classes already presented
in my article: Office
XP look & feel.
- First release.
- Adding flat borders and flat menubar.
- Kris Wojtas has updated the source
code to allow MenuXP to draw
"radio", "check" state and
gradient under bitmaps.
- 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.
03 - further update by Kris: