NMCUSTOMDRAW Structure

来源:互联网 发布:用友软件的应用 编辑:程序博客网 时间:2024/05/17 22:04
Contains information specific to an NM_CUSTOMDRAW notification message.
Syntax
typedef struct tagNMCUSTOMDRAWINFO {    NMHDR hdr;    DWORD dwDrawStage;    HDC hdc;    RECT rc;    DWORD_PTR dwItemSpec;    UINT uItemState;    LPARAM lItemlParam;} NMCUSTOMDRAW, *LPNMCUSTOMDRAW;
Members
hdr 
An NMHDR structure that contains information about this notification message. 
dwDrawStage 
// drawstage flags
// values under 0x00010000 are reserved for global custom draw values.
// above that are for specific controls
#define CDDS_PREPAINT           0x00000001
#define CDDS_POSTPAINT          0x00000002
#define CDDS_PREERASE           0x00000003
#define CDDS_POSTERASE          0x00000004
// the 0x000010000 bit means it's individual item specific
#define CDDS_ITEM               0x00010000
#define CDDS_ITEMPREPAINT       (CDDS_ITEM | CDDS_PREPAINT)
#define CDDS_ITEMPOSTPAINT      (CDDS_ITEM | CDDS_POSTPAINT)
#define CDDS_ITEMPREERASE       (CDDS_ITEM | CDDS_PREERASE)
#define CDDS_ITEMPOSTERASE      (CDDS_ITEM | CDDS_POSTERASE)
#if (_WIN32_IE >= 0x0400)
#define CDDS_SUBITEM            0x00020000
#endif
The current drawing stage. This is one of the following values. 
Global Values: 
CDDS_POSTERASE 
After the erasing cycle is complete.   擦除已结束 
CDDS_POSTPAINT 
After the painting cycle is complete.  绘制已结束 
CDDS_PREERASE 
Before the erasing cycle begins.  擦除未开始 
CDDS_PREPAINT 
Before the painting cycle begins.  绘制未开始 
Item-specific Values: 
CDDS_ITEM 
Indicates that the dwItemSpec, uItemState, and lItemlParam members are valid. 
如果在该阶段,那么,dwItemSpec, uItemState, and lItemlParam 成员是可用的 
CDDS_ITEMPOSTERASE 
After an item has been erased.  子项已擦除 
CDDS_ITEMPOSTPAINT 
After an item has been drawn.  子项以绘制 
CDDS_ITEMPREERASE 
Before an item is erased.  子项未擦除 
CDDS_ITEMPREPAINT 
Before an item is drawn.  子项未绘制 
CDDS_SUBITEM 
Version 4.71. Flag combined with CDDS_ITEMPREPAINT or CDDS_ITEMPOSTPAINT if a subitem is being drawn. This will only be set if CDRF_NOTIFYITEMDRAW is returned from CDDS_PREPAINT.
hdc 
A handle to the control's device context. Use this handle to a device context (HDC) to perform any Microsoft Windows Graphics Device Interface (GDI) functions. 
rc 
The RECT structure that describes the bounding rectangle of the area being drawn. This member is initialized only by the CDDS_ITEMPREPAINT notification. Version 5.80. This member is also initialized by the CDDS_PREPAINT notification. 
dwItemSpec 
The item number. What is contained in this member will depend on the type of control that is sending the notification. See the NM_CUSTOMDRAW notification reference for the specific control to determine what, if anything, is contained in this member. 
uItemState 
The current item state. This value is a combination of the following flags. 
CDIS_CHECKED 
The item is checked.   选中状态 
CDIS_DEFAULT 
The item is in its default state.   默认状态  
CDIS_DISABLED 
The item is disabled.    不可用状态 
CDIS_FOCUS 
The item is in focus.    获得焦点状态 
CDIS_GRAYED 
The item is grayed.    灰项 
CDIS_HOT 
The item is currently under the pointer ("hot").    鼠标在其上 
CDIS_INDETERMINATE 
The item is in an indeterminate state.     不确定状态 
CDIS_MARKED 
The item is marked. The meaning of this is determined by the implementation.     被标记状态 
CDIS_SELECTED 
The item is selected.     选中状态 
CDIS_SHOWKEYBOARDCUES 
Version 6.0.The item is a keyboard cue. 
Note that Comctl32 version 6 is not redistributable, but it is included with Windows XP or later operating systems. To use Comctl32.dll version 6, specify it in the manifest. For more information on manifests, see Enabling Visual Styles.
CDIS_NEARHOT 
The item is part of a control that is currently under the mouse pointer ("hot"), but the item is not "hot" itself. The meaning of this is determined by the implementation. 
CDIS_OTHERSIDEHOT 
The item is part of a splitbutton that is currently under the mouse pointer ("hot"), but the item is not "hot" itself. The meaning of this is determined by the implementation. 
CDIS_DROPHILITED 
The item is currently the drop target of a drag-and-drop operation.
lItemlParam 
Application-defined item data. 
Remarks
The value your application returns depends on the current drawing stage. The dwDrawStage member of the associated NMCUSTOMDRAW structure holds a value that specifies the drawing stage. When the dwDrawStage member equals CDDS_PREPAINT and CDDS_PREERASE, some controls send the CDDS_PREERASE message first and expect the return value to indicate which subsequent messages will be sent. For a code sample that illustrates states and drawing stages, see Customizing a Control's Appearance Using Custom Draw.
原创粉丝点击