Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This structure contains information about an item in a header control. This structure has been updated to support header item images and order values.

Syntax

typedef struct _HDITEM {
  UINT 
mask; 
  int 
cxy; 
  LPTSTR 
pszText; 
  HBITMAP 
hbm; 
  int 
cchTextMax; 
  int 
fmt; 
  LPARAM 
lParam; 
  int 
iImage;
  int 
iOrder;
} HDITEM;

Members

mask

Unsigned integer that specifies which other structure members contain valid data or must be filled in. It can be a combination of the following values.

Value Description

HDI_BITMAP

The hbmmember is valid.

HDI_FORMAT

The fmtmember is valid.

HDI_HEIGHT

The cxymember is valid and specifies the width of the item.

HDI_IMAGE

The iImagemember is valid and specifies the image to be displayed with the item.

HDI_LPARAM

The lParammember is valid.

HDI_ORDER

The iOrdermember is valid and specifies the item's order value.

HDI_TEXT

The pszTextand cchTextMaxmembers are valid.

HDI_WIDTH

The cxymember is valid and specifies the width of the item.

cxy

Integer that contains the width of the item.

pszText

Pointer to a null-terminated item string. If this member is set to LPSTR_TEXTCALLBACK, the control will request text information for this item by using HDN_GETDISPINFOmessages.

hbm

Handle to the item bitmap.

cchTextMax

Integer that contains the length of the item string, in characters.

fmt

Set of bit flags that specify the item's format.

This member can include one of the following text justification or right-to-left (RTL) reading order bit flags.

Value Description

HDF_CENTER

The item's contents are centered.

HDF_LEFT

The item's contents are left-aligned.

HDF_RIGHT

The item's contents are right-aligned.

HDF_RTLREADING

The header text will read in the opposite direction from the text in the parent window.

Note:
Typically, windows display text left-to-right (LTR). Windows can be mirrored to display languages such as Hebrew or Arabic that read right-to-left. Usually, header text is read in the same direction as the text in its parent window.

The preceding flag is combined with one of the following flags.

Value Description

HDF_BITMAP

The item displays a bitmap.

HDF_BITMAP_ON_RIGHT

The bitmap appears to the right of text. This does not affect an image from an image list assigned to the header item.

HDF_OWNERDRAW

The header control's owner draws the item.

HDF_STRING

The item displays a string.

Additionally, the following flag can be combined with any of the preceding flags.

Value Description

HDF_IMAGE

The item displays an image from an image list.

You can use the HDF_JUSTIFYMASK mask to isolate the text justification portion of the fmtmember.

lParam

Application-defined item data.

iImage

Integer that contains a zero-based index of an image within the image list. The specified image will be displayed in the header item, in addition to any image specified in the hbmmember. If iImageis set to I_IMAGECALLBACK, the control requests text information for this item by using HDN_GETDISPINFO messages.

iOrder

Integer that contains the order in which the item appears within the header control, from left to right. That is, the value for the far left item is 0. The value for the next item to the right is 1, and so on.

Remarks

The header control can display text, an image and a bitmap for an item all at the same time. The alignment flags determine the order in which they appear. With HDF_LEFT or HDF_CENTER, the order is image, text, and then bitmap. With HDF_RIGHT the order is bitmap, image and then text.

To define the dimensions of a header control, set the prcmember of the HDLAYOUTstructure to point to a RECTstructure that contains the dimensions that you want to use. You can only change the width of the header control at runtime.

Requirements

Header commctrl.h
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also