int InsertItem( int nPos, HDITEM* phdi );
Return Value
Index of the new item if successful; otherwise – 1.
Parameters
nPos
The zero-based index of the item to be inserted. If the value is zero, the item is inserted at the beginning of the header control. If the value is greater than the maximum value, the item is inserted at the end of the header control.
phdi
Pointer to an HDITEM structure that contains information about the item to be inserted.
Remarks
Inserts a new item into a header control at the specified index.
Example
// The pointer to my header control.
extern CHeaderCtrl* pmyHeaderCtrl;
CString str;
HDITEM hdi;
hdi.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT;
hdi.cxy = 100; // Make all columns 100 pixels wide.
hdi.fmt = HDF_STRING | HDF_CENTER;
// Insert 6 columns in the header control.
for (int i=0;i < 6;i++)
{
str.Format(TEXT("column %d"), i);
hdi.pszText = str.GetBuffer(0);
pmyHeaderCtrl->InsertItem(i, &hdi);
}
CHeaderCtrl Overview | Class Members | Hierarchy Chart
See Also CHeaderCtrl::DeleteItem, CHeaderCtrl::GetItem