CListBox::SetItemHeight
목록 상자에서 항목의 높이 설정합니다.
int SetItemHeight(
int nIndex,
UINT cyItemHeight
);
매개 변수
nIndex
목록 상자에서 항목의 인덱스를 지정합니다.목록 상자가 있는 경우에이 매개 변수 사용 되는 LBS_OWNERDRAWVARIABLE 스타일. 그렇지 않으면 0으로 설정 해야 합니다.cyItemHeight
높이 픽셀 단위로 항목을 지정합니다.
반환 값
LB_ERR 인덱스 또는 높이가 잘못 된 경우.
설명
목록 상자에 있는 경우는 LBS_OWNERDRAWVARIABLE 스타일,이 함수에서 지정 된 항목의 높이 설정 nIndex.그렇지 않으면이 함수는 목록 상자에서 모든 항목의 높이 설정합니다.
예제
// Set the height of every item to be the
// vertical size of the item's text extent.
CString str;
CSize sz;
CDC* pDC = myListBox.GetDC();
for (int i = 0; i < myListBox.GetCount(); i++)
{
myListBox.GetText(i, str);
sz = pDC->GetTextExtent(str);
myListBox.SetItemHeight(i, sz.cy);
}
myListBox.ReleaseDC(pDC);
요구 사항
헤더: afxwin.h