CComboBox::GetItemHeight

호출 된 GetItemHeight 멤버 함수를 콤보 상자에 목록 항목의 높이 검색 합니다.

int GetItemHeight( 
   int nIndex  
) const;

매개 변수

  • nIndex
    콤보 상자의 높이 검색 해야 하는 구성 요소를 지정 합니다. 경우는 nIndex 매개 변수는 – 1, 콤보 상자의 편집 컨트롤 (또는 정적 텍스트) 부분의 높이 검색 합니다. 콤보 상자가 있는 경우는 CBS_OWNERDRAWVARIABLE 스타일을 nIndex 높이 검색할 목록 항목의 인덱스를 지정 합니다. 그렇지 않으면 nIndex 0으로 설정 해야 합니다.

반환 값

콤보 상자에 지정 된 항목의 픽셀 높이입니다. 반환 값이 CB_ERR 오류가 발생 합니다.

예제

// Set the height of every item so the item 
// is completely visible.
CString strLBText;
CSize   size;
CDC*    pDC = m_pComboBox->GetDC();
for (int i = 0; i < m_pComboBox->GetCount(); i++)
{
   m_pComboBox->GetLBText(i, strLBText);
   size = pDC->GetTextExtent(strLBText);

   // Only want to set the item height if the current height 
   // is not big enough. 
   if (m_pComboBox->GetItemHeight(i) < size.cy)
      m_pComboBox->SetItemHeight( i, size.cy );
}
m_pComboBox->ReleaseDC(pDC);

요구 사항

헤더: afxwin.h

참고 항목

참조

CComboBox 클래스

계층 구조 차트

CComboBox::SetItemHeight

WM_MEASUREITEM

CB_GETITEMHEIGHT