This documentation is archived and is not being maintained.


Called by the framework when a menu with the owner-draw style is created.

virtual void MeasureItem( 
   LPMEASUREITEMSTRUCT lpMeasureItemStruct  


A pointer to a MEASUREITEMSTRUCT structure.

By default, this member function does nothing. Override this member function and fill in the MEASUREITEMSTRUCT structure to inform Windows of the menu's dimensions.

See CWnd::OnMeasureItem for a description of the MEASUREITEMSTRUCT structure.

The following code is from the MFC CTRLTEST sample:

// Override MeasureItem() to return the size of the menu item. 
// CColorMenu is a CMenu-derived class. 

#define COLOR_BOX_WIDTH     20
#define COLOR_BOX_HEIGHT    20

void CColorMenu::MeasureItem(LPMEASUREITEMSTRUCT lpMIS)
   // all items are of fixed size
   lpMIS->itemWidth = COLOR_BOX_WIDTH;
   lpMIS->itemHeight = COLOR_BOX_HEIGHT;

Header: afxwin.h