DRAWITEMSTRUCT (Windows Embedded CE 6.0)
1/6/2010
This structure provides information that the owner window must have to determine how to paint an owner-drawn control or menu item.
Syntax
typedef struct tagDRAWITEMSTRUCT {
UINT CtlType;
UINT CtlID;
UINT itemID;
UINT itemAction;
UINT itemState;
HWND hwndItem;
HDC hDC;
RECT rcItem;
ULONG_PTR itemData;
} DRAWITEMSTRUCT;
Members
CtlType
Unsigned integer that specifies the control type. It can be one of the following values.Value Description ODT_BUTTON
Owner-drawn button
ODT_LISTVIEW
Owner-draw list view control
ODT_MENU
Owner-drawn menu
ODT_TAB
Tab control
- CtlID
Unsigned integer that specifies the identifier of the combo box, list box, or button. This member is not used for a menu.
- itemID
Unsigned integer that specifies the menu item identifier for a menu item or the index of the item in a list box or combo box. For an empty list box or combo box, this member can be –1. This value allows the application to draw only the focus rectangle at the coordinates specified by the rcItem member, even though the control contains no items. This focus rectangle indicates to the user whether the list box or combo box has the focus. The value of the itemAction member determines whether the rectangle is to be drawn as though the list box or combo box has the focus.
itemAction
Unsigned integer that specifies the drawing action required. This member can have one or more of the following values.Value Description ODA_DRAWENTIRE
The entire control needs to be drawn.
ODA_FOCUS
The control has lost or gained the keyboard focus. You should check the itemState member to determine whether the control has the focus.
ODA_SELECT
The selection status has changed. You should check the itemState member to determine the new selection state.
itemState
Unsigned integer that specifies the visual state of the item after the current drawing action takes place. It can be a combination of the following values.Value Description ODS_CHECKED
The menu item is to be checked. Use this value only in a menu.
ODS_COMBOBOXEDIT
The drawing takes place in the edit control of an owner-drawn combo box.
ODS_DEFAULT
The item is the default item.
ODS_DISABLED
The item is to be drawn as disabled.
ODS_FOCUS
The item has the keyboard focus.
ODS_GRAYED
The item is to be grayed. Use this value only in a menu.
ODS_SELECTED
The status of the menu item is selected.
- hwndItem
Handle to the control for combo boxes, list boxes, buttons, and static controls. For menus, this member is a handle to the menu containing the item.
- hDC
Handle to a device context. You must use this device context when performing drawing operations on the control.
- rcItem
RECT structure that specifies a rectangle that defines the boundaries of the control to be drawn. This rectangle is in the device context that you specified with the hDC member. The OS automatically clips anything that the owner window draws in the device context for combo boxes, list boxes, and buttons, but does not clip menu items. When drawing menu items, the owner window must not draw outside the boundaries of the rectangle defined by the rcItem member.
itemData
Pointer to an unsigned long that specifies the application-defined 32-bit value associated with the menu item. For a control, this member 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 passed to the list box or combo box in the lParam parameter of one of the following messages:If CtlTypeis ODT_BUTTON, itemData is zero.
Remarks
The owner window of the owner-drawn control or menu item receives a pointer to this structure as the lParam parameter of the WM_DRAWITEM message.
Requirements
Header | windows.h |
Windows Embedded CE | Windows CE 1.0 and later |
See Also
Reference
Combo Boxes Structures
CB_ADDSTRING
CB_INSERTSTRING
CB_SETITEMDATA
LB_ADDSTRING
LB_INSERTSTRING
LB_SETITEMDATA
WM_DRAWITEM