Поделиться через


CListBox::GetHorizontalExtent

Retrieves from the list box the width in pixels by which it can be scrolled horizontally.

int GetHorizontalExtent( ) const;

Возвращаемое значение

The scrollable width of the list box, in pixels.

Заметки

This is applicable only if the list box has a horizontal scroll bar.

Пример

// Find the longest string in the list box.
CString str;
CSize   sz;
int     dx=0;
CDC*    pDC = m_myListBox.GetDC();
for (int i=0;i < m_myListBox.GetCount();i++)
{
   m_myListBox.GetText( i, str );
   sz = pDC->GetTextExtent(str);

   if (sz.cx > dx)
      dx = sz.cx;
}
m_myListBox.ReleaseDC(pDC);

// Set the horizontal extent only if the current extent is not large enough.
if (m_myListBox.GetHorizontalExtent() < dx)
{
   m_myListBox.SetHorizontalExtent(dx);
   ASSERT(m_myListBox.GetHorizontalExtent() == dx);
}

Требования

Header: afxwin.h

См. также

Основные понятия

CListBox Class

CListBox Members

Hierarchy Chart

CListBox::SetHorizontalExtent

LB_GETHORIZONTALEXTENT