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


CListBox::SetAnchorIndex

Sets the anchor in a multiple-selection list box to begin an extended selection.

void SetAnchorIndex(
   int nIndex 
);

Параметры

  • nIndex
    Specifies the zero-based index of the list-box item that will be the anchor.

Заметки

In a multiple-selection list box, the anchor item is the first or last item in a block of contiguous selected items.

Пример

void CMyODListBox::OnLButtonDown(UINT nFlags, CPoint point)
{
   BOOL bOutside = TRUE;
   UINT uItem = ItemFromPoint(point, bOutside);

   if (!bOutside)
   {
      // Set the anchor to be the middle item.
      SetAnchorIndex(uItem);
      ASSERT((UINT)GetAnchorIndex() == uItem);
   }

   CListBox::OnLButtonDown(nFlags, point);
}

Требования

Header: afxwin.h

См. также

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

CListBox Class

CListBox Members

Hierarchy Chart

CListBox::GetAnchorIndex