CListBox::SetItemHeight
intSetItemHeight(intnIndex**,UINTcyItemHeight);**
Return Value
LB_ERR if the index or height is invalid.
Parameters
nIndex
Specifies the zero-based index of the item in the list box. This parameter is used only if the list box has the LBS_OWNERDRAWVARIABLE style; otherwise, it should be set to 0.
cyItemHeight
Specifies the height, in pixels, of the item.
Remarks
An application calls the SetItemHeight member function to set the height of items in a list box. If the list box has the LBS_OWNERDRAWVARIABLE style, this function sets the height of the item specified by nIndex. Otherwise, this function sets the height of all items in the list box.
Example
// The pointer to my list box.
extern CListBox* pmyListBox;
// Set the height of every item to be the
// vertical size of the item's text extent.
CString str;
CSize sz;
int dx=0;
CDC* pDC = pmyListBox->GetDC();
for (int i=0;i < pmyListBox->GetCount();i++)
{
pmyListBox->GetText( i, str );
sz = pDC->GetTextExtent(str);
pmyListBox->SetItemHeight( i, sz.cy );
}
pmyListBox->ReleaseDC(pDC);
CListBox Overview | Class Members | Hierarchy Chart
See Also CListBox::GetItemHeight,