CComboBox::GetHorizontalExtent

콤보 상자에서 콤보 상자의 목록 상자 부분에서 가로로 스크롤할 수 픽셀 단위로 너비를 검색 합니다.

UINT GetHorizontalExtent( ) const;

반환 값

스크롤할 수 있는 너비 픽셀에서 콤보 상자의 목록 상자 부분입니다.

설명

이 콤보 상자의 목록 상자 부분에 가로 스크롤 막대가 있는 경우에 적용할 수 있습니다.

예제

// Find the longest string in the combo box.
CString strText;
CSize   sz;
UINT    dxText = 0;
CDC*    pDCCombo = m_pComboBox->GetDC();
for (int i = 0; i < m_pComboBox->GetCount(); i++)
{
   m_pComboBox->GetLBText(i, strText);
   sz = pDCCombo->GetTextExtent(strText);

   if (sz.cx > (LONG)dxText)
     dxText = sz.cx;
}
m_pComboBox->ReleaseDC(pDCCombo);

// Set the horizontal extent only if the current extent is not large enough. 
if (m_pComboBox->GetHorizontalExtent() < dxText)
{
   m_pComboBox->SetHorizontalExtent(dxText);
   ASSERT(m_pComboBox->GetHorizontalExtent() == dxText);
}

요구 사항

헤더: afxwin.h

참고 항목

참조

CComboBox 클래스

계층 구조 차트

CListBox::SetHorizontalExtent

CB_GETHORIZONTALEXTENT