NM_CUSTOMDRAW (list view) Notification
**NM_CUSTOMDRAW(list view)**通知
Sent by a list-view control to notify its parent windows about drawing operations. This notification is sent in the form of a WM_NOTIFY message.
list-view控件向其父窗口发送重绘操作的通知。这些通知以WM_NOTIFY消息的形式发送。
Syntax
NM_CUSTOMDRAW
lpNMCustomDraw = (LPNMLVCUSTOMDRAW) lParam;
Parameters
lpNMCustomDraw
Pointer to a NMLVCUSTOMDRAW structure that contains information about the drawing operation. The first member of this structure, nmcd, is a pointer to an NMCUSTOMDRAW structure. The dwItemSpec member of the structure pointed to by nmcd contains the identifier of the item being drawn and the lItemlParam member contains its application-defined data.
包含重绘操作信息的NMLVCUSTOMDRAW结构体指针。Nmcd是此结构体的第一个成员,它是指向NMCUSTOMDRAW结构体的指针。Nmcd的结构体包含了正被重绘成员的标识符dwItemSpec和应用程序定义的数据lItemlParam。
Return Value
The value your application can return depends on the current drawing stage. The dwDrawState member of the associated NMCUSTOMDRAW structure holds a value that specifies the drawing stage. You must return one of the following values.
程序的返回值可以根据当前的绘制阶段而定。NMCUSTOMDRAW结构体成员dwDrawState指定了一个代表当前状态的值。你必须返回下列这些值。
CDRF_DODEFAULT
The control will draw itself. It will not send any additional NM_CUSTOMDRAW messages for this paint cycle. This occurs when dwDrawState equals CDDS_PREPAINT.
控件将绘制自己。它将不再为循环绘画发送额外的NM_CUSTOMDRAW消息。当dwDrawState****为CDDS_PREPAINT时将发生这种情况。
CDRF_DOERASE
Windows Vista. The control will not draw the focus rect around an item.
在Windows Vista中,控件将不再绘制项目焦点周围的矩形。
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 dwDrawState equals CDDS_PREPAINT.
控件将通知绘画操作给任何项目相关的父窗口。在重绘前后它将发送CUSTOMDRAW通知。当dwDrawState****为CDDS_PREPAINT时将发生这种情况。
CDRF_NOTIFYITEMERASE
Windows NT 4.0 only. The control will notify the parent when an item will be erased. It will send NM_CUSTOMDRAW notification messages before and after erasing items. This occurs when dwDrawState equals CDDS_PREPAINT.
只对Windows NT 4.0有效。当控件要擦除一个项目时它将通知其父窗口。在重绘前后它将发送CUSTOMDRAW通知。当dwDrawState****为CDDS_PREPAINT时将发生这种情况。
CDRF_NOTIFYPOSTERASE
The control will notify the parent after erasing an item. This occurs when dwDrawState equals CDDS_PREPAINT.
当控件擦除一个项目后它将通知其父窗口。当dwDrawState****为CDDS_PREPAINT时将发生这种情况。
CDRF_NOTIFYPOSTPAINT
The control will notify the parent after painting an item. This occurs when dwDrawState equals CDDS_PREPAINT.
当控件重绘一个项目后它将通知其父窗口。当dwDrawState****为CDDS_PREPAINT时将发生这种情况。
CDRF_NEWFONT
The application specified a new font for the item; the control will use the new font. For more information about changing fonts, see Changing fonts and colors. This occurs when dwDrawState equals CDDS_ITEMPREPAINT.
当应用程序为项目设定新字体,控件也将使用这个新字体。更多关于改变字体的信息请参考Changing fonts and colors。当dwDrawState****为CDDS_ITEMPREPAINT时将发生这种情况。
CDRF_NOTIFYSUBITEMDRAW
Version 4.71. Your application will receive an NM_CUSTOMDRAW message with dwDrawState 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 dwDrawState equals CDDS_ITEMPREPAINT.
4.71版本。在list-view 子项目被重绘前应用程序将接收到NM_CUSTOMDRAW消息,而dwDrawState 被设置为 CDDS_ITEMPREPAINT | CDDS_SUBITEM。当dwDrawState****为CDDS_ITEMPREPAINT时将发生这种情况。
CDRF_SKIPDEFAULT
The application drew the item manually. The control will not draw the item. This occurs when dwDrawState equals CDDS_ITEMPREPAINT.
应用程序手动重绘项目。控件不会绘制项目。当dwDrawState****为CDDS_ITEMPREPAINT时将发生这种情况。
CDRF_SKIPPOSTPAINT
Windows Vista. The control will only paint the background.
在Windows Vista中,控件将只绘制背景。
Remarks
Version 5.80. If you change the font by returning CDRF_NEWFONT, the list-view control might display clipped text. This behavior is necessary for backward compatibility with earlier versions of the common controls. If you want to change the font of a list-view control, you will get better results if you send a CCM_SETVERSION message with the wParam value set to 5 before adding any items to the control.
Version 5.80.如果你通过返回CDRF_NEWFONT改变字体,list-view控件可能会显示省略的文本信息。这样做主要是为了向后兼容早期的通用控件版本。如果你想改变list-view控件的字体,在给控件添加任何项目前发送CCM_SETVERSION消息并将_wParam_设为5,你将得到更好的结果。
Notification Requirements
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