COffice2003Menu - A menu class with the Office 2003 look. This class converts your menu into a Office2003 look-a-like. It supports bitmaps and requires only a small modification of your existing application.
Usage: Add an instance of the class to the window that contains the menu: COffice2003Menu m_Office2003Menu;
On creation of the window attach the COffice2003Menu to the window, this replaces the standard menu.
m_Office2003Menu.Initialize(this, IDR_MAINFRAME, IDB_TOOLBAR); where: IDR_MAINFRAME is the ID of the menu IDB_TOOLBAR is the ID of the bitmaps to use.
Make sure to remove the menu at destruction of the window: m_Office2003Menu.UnInitialize();
you also need to route the following messages: void CWnd::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) { m_Office2003Menu.DrawItem(lpDrawItemStruct); CWnd::OnDrawItem(nIDCtl, lpDrawItemStruct); }
void CWnd::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) { m_Office2003Menu.MeasureItem(lpMeasureItemStruct); CWnd::OnMeasureItem(nIDCtl, lpMeasureItemStruct); }
and finally to draw the complete menubar in gradient add this to OnNcPaint():
void CWnd::OnNcPaint() { Default(); // paint menu bar m_Office2003Menu.DrawMenuBar(); }
the example contains some code to optimize drawing of the non-client area (to prevent flickering).
Download demo executable
Download source code This class is part of the Pablo Software Solutions MFC Extension Package - Controls Edition
|