MEASUREITEMSTRUCT

Version 3.0

Owner-Draw Control Dimensions

The MEASUREITEMSTRUCT data structure informs Windows of the dimensions of an owner-draw control. This allows Windows to process user interaction with the control correctly. The owner 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 fields in the structure for the control and returns. This structure is common to all owner-draw controls.

The MEASUREITEMSTRUCT structure has the following format:

typedef struct tagMEASUREITEMSTRUCT

{

WORD CtlType;

WORD CtlID;

WORD itemID;

WORD itemWidth;

WORD itemHeight;

DWORD itemData

} MEASUREITEMSTRUCT;

The MEASUREITEMSTRUCT structure contains the following fields:

Field Description  
CtlType Is the control type. The values for control types are as follows:  
  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 Is the control ID for a combo box, list box, or button. This field is not used for a menu.  
itemID Is the menu-item ID for a menu or the list-box item ID for a variable-height combo box or list box. This field is not used for a fixed-height combo box or list box, or for a button.  
itemWidth Specifies the width of a menu item. The owner of the owner-draw menu item must fill this field before returning from the message.  
itemHeight Specifies the height 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 field.  
itemData Contains the value that was passed to the combo box or list box in the lParam parameter of one of the following messages:  
  CB_ADDSTRING  
  CB_INSERTSTRING  
  LB_ADDSTRING  
  LB_INSERTSTRING  
  Contains the DWORD value passed as the lpNewItem parameter of the AppendMenu, InsertMenu, or ModifyMenu function that added or modified the menu item. Its contents are undefined for buttons.  

Comments

Failure to fill out the proper fields in the MEASUREITEM structure will cause improper operation of the control.