This topic has not yet been rated - Rate this topic

NMLVCUSTOMDRAW structure

Applies to: desktop apps only

Contains information specific to an NM_CUSTOMDRAW (list view) notification code sent by a list-view control.

Syntax

typedef struct tagNMLVCUSTOMDRAW {
  NMCUSTOMDRAW nmcd;
  COLORREF     clrText;
  COLORREF     clrTextBk;
#if (_WIN32_IE >= 0x0400)
  int          iSubItem;
#endif 
#if (_WIN32_IE >= 0x0560)
  DWORD        dwItemType;
  COLORREF     clrFace;
  int          iIconEffect;
  int          iIconPhase;
  int          iPartId;
  int          iStateId;
  RECT         rcText;
  UINT         uAlign;
#endif 
} NMLVCUSTOMDRAW, *LPNMLVCUSTOMDRAW;

Members

nmcd

Type: NMCUSTOMDRAW

NMCUSTOMDRAW structure that contains general custom draw information.

clrText

Type: COLORREF

COLORREF value representing the color that will be used to display text foreground in the list-view control.

clrTextBk

Type: COLORREF

COLORREF value representing the color that will be used to display text background in the list-view control. In Version 6.0., this member is ignored if the background image is set with the LVM_SETBKIMAGE message.

iSubItem

Type: int

Version 4.71. Index of the subitem that is being drawn. If the main item is being drawn, this member will be zero.

dwItemType

Type: DWORD

Version 6.0.   DWORD that contains the type of the item to draw. This member can be one of the following values.

ValueMeaning
LVCDI_ITEM

An item is to be drawn.

LVCDI_GROUP

A group is to be drawn.

LVCDI_ITEMSLIST

Every item is to be drawn.

 

clrFace

Type: COLORREF

Version 6.0.  COLORREF value representing the color that will be used to display the face of an item.

iIconEffect

Type: int

Version 6.0.  Value of type int that specifies the effect that is applied to an icon, such as Glow, Shadow, or Pulse.

iIconPhase

Type: int

Version 6.0.  Value of type int that specifies the phase of an icon.

iPartId

Type: int

Version 6.0.  Value of type int that specifies the ID of the part of an item to draw.

iStateId

Type: int

Version 6.0.  Value of type int that specifies the ID of the state of an item to draw.

rcText

Type: RECT

Version 6.0.  RECT that specifies the rectangle in which the text is to be drawn.

uAlign

Type: UINT

Version 6.0.  UINT that specifies how a group should be aligned. This member can be one of the following values.

ValueMeaning
LVGA_HEADER_CENTER

Center the group.

LVGA_HEADER_LEFT

Align the group on the left.

LVGA_HEADER_RIGHT

Align the group on the right.

 

Remarks

Note  Comctl32.dll version 6 is not redistributable but it is included in Windows XP or later. To use Comctl32.dll version 6, specify it in a manifest. For more information on manifests, see Enabling Visual Styles.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Commctrl.h

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Bug on earlier versions of Windows
Handling subitem pre-paint messages on Windows XP (perhaps all pre-Vista systems?) the handler receives incorrect top and bottom values in NMLVCUSTOMDRAW::nmcd.rc, sometimes they are zero, sometimes are not updated since previous handler call (so basically the idea is that they are left uninitialized by comctl32 caller). In order to get correct subitem position the handler has to explicitly obtain rectangle using a separate message/call:

RECT Position;
ListView.GetSubItemRect((INT) pHeader->nmcd.dwItemSpec, pHeader->iSubItem, LVIR_BOUNDS, &Position);

Info about iIconEffect, iIconPhase
Add more description about these members.
Typo in syntax section.
int iStateId:

This entry of the structure is terminated by a colon instead of a semi-colon.