CMenu::MeasureItem

virtualvoidMeasureItem(LPMEASUREITEMSTRUCTlpMeasureItemStruct**);**

Parameters

lpMeasureItemStruct

A pointer to a MEASUREITEMSTRUCT structure.

Remarks

Called by the framework when a menu with the owner-draw style is created. 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.

Example

The following code is from the MFC 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;
}

CMenu OverviewClass MembersHierarchy Chart