int SetItemHeight( int nIndex, UINT cyItemHeight );
Return Value
CB_ERR if the index or height is invalid; otherwise 0.
Parameters
nIndex
Specifies whether the height of list items or the height of the edit-control (or static-text) portion of the combo box is set.
If the combo box has the CBS_OWNERDRAWVARIABLE style, nIndex specifies the zero-based index of the list item whose height is to be set; otherwise, nIndex must be 0 and the height of all list items will be set.
If nIndex is –1, the height of the edit-control or static-text portion of the combo box is to be set.
cyItemHeight
Specifies the height, in pixels, of the combo-box component identified by nIndex.
Remarks
Call the SetItemHeight member function to set the height of list items in a combo box or the height of the edit-control (or static-text) portion of a combo box.
The height of the edit-control (or static-text) portion of the combo box is set independently of the height of the list items. An application must ensure that the height of the edit-control (or static-text) portion is not smaller than the height of a particular list-box item.
Example
// The pointer to my combo box.
extern CComboBox* pmyComboBox;
// 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 = pmyComboBox->GetDC();
for (int i=0;i < pmyComboBox->GetCount();i++)
{
pmyComboBox->GetLBText( i, str );
sz = pDC->GetTextExtent(str);
pmyComboBox->SetItemHeight( i, sz.cy );
}
pmyComboBox->ReleaseDC(pDC);
CComboBox Overview | Class Members | Hierarchy Chart
See Also CComboBox::GetItemHeight, WM_MEASUREITEM, CB_SETITEMHEIGHT