WM_DRAWITEM
idCtl = (int) wParam; /* control identifier */
lpdis = (const DRAWITEMSTRUCT FAR*) lParam; /* structure */
The WM_DRAWITEM message is sent to the owner of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.
idCtl
Value of wParam. Specifies the identifier of the control that sent the WM_DRAWITEM message. This parameter is zero if the message was sent by a menu.
lpdis
Value of lParam. Points to a DRAWITEMSTRUCT structure that contains information about the item to be drawn and the type of drawing required. The DRAWITEMSTRUCT structure has the following form:
typedef struct tagDRAWITEMSTRUCT { /* ditm */
UINT CtlType;
UINT CtlID;
UINT itemID;
UINT itemAction;
UINT itemState;
HWND hwndItem;
HDC hDC;
RECT rcItem;
DWORD itemData;
} DRAWITEMSTRUCT;
An application should return TRUE if it processes this message.
The itemAction member of the DRAWITEMSTRUCT structure defines the drawing operation that is to be performed. The data in this member allows the owner of the control to determine what drawing action is required.
Before returning from processing this message, an application should ensure that the device context identified by the hDC member of the DRAWITEMSTRUCT structure is in the default state.
This example shows how to process the WM_DRAWITEM message:
LPDRAWITEMSTRUCT lpdis;
case WM_DRAWITEM:
lpdis = (DRAWITEMSTRUCT FAR*) lParam;
switch (lpdis->itemAction) {
case ODA_DRAWENTIRE:
.
. /* Redraw the entire control or menu. */
.
return TRUE;
case ODA_SELECT:
.
. /* Redraw to reflect current selection state. */
.
return TRUE;
case ODA_FOCUS:
.
. /* Redraw to reflect current focus state. */
.
return TRUE;
}
break;
WM_COMPAREITEM, WM_DELETEITEM, WM_INITDIALOG, WM_MEASUREITEM