MEASUREITEMSTRUCT

typedef struct tagMEASUREITEMSTRUCT { /* mis */

UINT CtlType;

UINT CtlID;

UINT itemID;

UINT itemWidth;

UINT itemHeight;

DWORD itemData;

} MEASUREITEMSTRUCT;

The MEASUREITEMSTRUCT structure indicates to Windows the dimensions of an owner-draw control. This allows Windows to process user interaction with the control correctly. The owner window of an owner-draw control receives a pointer to this structure as the lParam parameter of an WM_MEASUREITEM message. The owner-draw control sends this message to its owner window when the control is created; the owner then fills in the appropriate members in the structure for the control and returns. This structure is common to all owner-draw controls.

Members

CtlType

Specifies the control type. This member can be one of the following values:

Value Meaning

ODT_BUTTON Owner-draw button.
ODT_COMBOBOX Owner-draw combo box.
ODT_LISTBOX Owner-draw list box.
ODT_MENU Owner-draw menu.

CtlID

Specifies the control identifier for a combo box, list box, or button. This member is not used for a menu.

itemID

Specifies the menu-item identifier for a menu item or the list-box item identifier for a variable-height combo box or list box. This member is not used for a fixed-height combo box or list box, or for a button.

itemWidth

Specifies the width, in pixels, of a menu item. The owner of the owner-draw menu item must fill this member before returning from the message.

itemHeight

Specifies the height, in pixels, of an individual item in a list box or a menu. Before returning from the message, the owner of the owner-draw combo box, list box, or menu item must fill out this member.

itemData

Specifies the application-defined 32-bit value associated with the menu item. For a control, this parameter specifies the value last assigned to the list box or combo box by the LB_SETITEMDATA or CB_SETITEMDATA message. If the list box or combo box has the LB_HASSTRINGS or CB_HASSTRINGS style, this value is initially zero. Otherwise, this value is initially the value that was passed to the list box or combo box in the lParam parameter of one of the following messages:

CB_ADDSTRING CB_INSERTSTRING LB_ADDSTRING LB_INSERTSTRING

Comments

If an application does not fill the appropriate members of the MEASUREITEMSTRUCT structure, the control or menu item may not be drawn properly.