We recommend using Visual Studio 2017

MEASUREITEMSTRUCT Structure

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at MEASUREITEMSTRUCT Structure.

The MEASUREITEMSTRUCT structure informs Windows of the dimensions of an owner-drawn control or menu item.

typedef struct tagMEASUREITEMSTRUCT {  
    UINT CtlType;  
    UINT CtlID;  
    UINT itemID;  
    UINT itemWidth;  
    UINT itemHeight;  
    DWORD itemData  
} MEASUREITEMSTRUCT;  

Parameters

CtlType
Contains the control type. The values for control types are as follows:

  • ODT_COMBOBOX Owner-draw combo box

  • ODT_LISTBOX Owner-draw list box

  • ODT_MENU Owner-draw menu

CtlID
Contains the control ID for a combo box, list box, or button. This member is not used for a menu.

itemID
Contains the menu-item ID for a menu or the list-box-item ID 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 of a menu item. The owner of the owner-draw menu item must fill this member before it returns from the message.

itemHeight
Specifies the height of an individual item in a list box or a menu. Before it returns from the message, the owner of the owner-draw combo box, list box, or menu item must fill out this member. The maximum height of a list box item is 255.

itemData
For a combo box or list box, this member contains the value that was passed to the list box by one of the following:

  • CComboBox::AddString

  • CComboBox::InsertString

  • CListBox::AddString

  • CListBox::InsertString

For a menu, this member contains the value that was passed to the menu by one of the following:

  • CMenu::AppendMenu

  • CMenu::InsertMenu

  • CMenu::ModifyMenu

This allows Windows to process user interaction with the control correctly. Failure to fill out the proper members in the MEASUREITEMSTRUCT structure will cause improper operation of the control.

Header: winuser.h

Structures, Styles, Callbacks, and Message Maps
CWnd::OnMeasureItem

Show: