Sent by some common controls to notify their parent windows about drawing operations. This notification is sent in the form of a WM_NOTIFY message.
To send this message, call the
SendMessage
function as follows.
Syntax
NM_CUSTOMDRAW
#ifdef LIST_VIEW_CUSTOM_DRAW
lpNMCustomDraw = (LPNMLVCUSTOMDRAW) lParam;
#elif TOOL_TIPS_CUSTOM_DRAW
lpNMCustomDraw = (LPNMTTCUSTOMDRAW) lParam;
#elif TREE_VIEW_CUSTOM_DRAW
lpNMCustomDraw = (LPNMTVCUSTOMDRAW) lParam;
#elif TOOL_BAR_CUSTOM_DRAW
lpNMCustomDraw = (LPNMTBCUSTOMDRAW) lParam;
#else
lpNMCustomDraw = (LPNMCUSTOMDRAW) lParam;
#endif
Parameters
- lpNMCustomDraw
-
A pointer to a custom draw-related structure that contains information about the drawing operation. The following list specifies the controls and their associated structures.
List view- NMLVCUSTOMDRAW
ToolTip- NMTTCUSTOMDRAW
Tree view- NMTVCUSTOMDRAW
Toolbar- NMTBCUSTOMDRAW
All other supported controls- NMCUSTOMDRAW
Return Value
The value your application can return depends on the current drawing stage. The dwDrawStage member of the associated NMCUSTOMDRAW structure holds a value that specifies the drawing stage. You must return one of the following values.
| CDRF_NOTIFYITEMDRAW | The control will notify the parent of any item-related drawing operations. It will send NM_CUSTOMDRAW notification messages before and after drawing items. This occurs when
dwDrawStage equals CDDS_PREPAINT. |
| CDRF_NOTIFYPOSTERASE | The control will notify the parent after erasing an item. This occurs when
dwDrawStage equals CDDS_PREPAINT. |
| CDRF_NOTIFYPOSTPAINT | The control will notify the parent after painting an item. This occurs when
dwDrawStage equals CDDS_PREPAINT. |
| CDRF_NEWFONT | Your application specified a new font for the item; the control will use the new font. For more information on changing fonts, see Changing fonts and colors. This occurs when
dwDrawStage equals CDDS_ITEMPREPAINT. |
| CDRF_NOTIFYSUBITEMDRAW | Version 4.71. Your application will receive an NM_CUSTOMDRAW message with
dwDrawStage set to CDDS_ITEMPREPAINT | CDDS_SUBITEM before each list-view subitem is drawn. You can then specify font and color for each subitem separately or return CDRF_DODEFAULT for default processing. This occurs when
dwDrawStage equals CDDS_ITEMPREPAINT. |
| CDRF_SKIPDEFAULT | Your application drew the item manually. The control will not draw the item. This occurs when
dwDrawStage equals CDDS_ITEMPREPAINT. |
| CDRF_DOERASE | draw the background |
| CDRF_SKIPPOSTPAINT | don't draw the focus rect |
Remarks
Currently, the following controls support custom draw functionality: header, list view, rebar, toolbar, ToolTip, trackbar, and tree view. Custom draw is also supported for button controls if you are running Windows XP and have an application manifest to ensure that Comctl32.dll version 6 is available.
If this message is handled in a dialog procedure, you must set the return value as part of the window data before returning TRUE. For more information, see DialogProc Function.
Message Information
| Minimum DLL Version | comctl32.dll version 4.70 or later |
|---|
| Header | commctrl.h |
|---|
| Minimum operating systems |
Windows 2000, Windows NT 4.0 with Internet Explorer 3.0, Windows 98, Windows 95 with Internet Explorer 3.0 |
|---|