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


CListBox::SetCaretIndex

Sets the focus rectangle to the item at the specified index in a multiple-selection list box.

int SetCaretIndex(
   int nIndex,
   BOOL bScroll = TRUE 
);

Параметры

  • nIndex
    Specifies the zero-based index of the item to receive the focus rectangle in the list box.

  • bScroll
    If this value is 0, the item is scrolled until it is fully visible. If this value is not 0, the item is scrolled until it is at least partially visible.

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

LB_ERR if an error occurs.

Заметки

If the item is not visible, it is scrolled into view.

Пример

// Set the caret to be the middle item.
m_myListBox.SetCaretIndex(m_myListBox.GetCount()/2);
ASSERT(m_myListBox.GetCaretIndex() == m_myListBox.GetCount()/2);

Требования

Header: afxwin.h

См. также

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

CListBox Class

CListBox Members

Hierarchy Chart

CListBox::GetCaretIndex

LB_SETCARETINDEX