MFC Library Reference CListCtrl::GetTopIndex
Retrieves the index of the topmost visible item when in list view or report view.int GetTopIndex( ) const;
Return Value
The index of the topmost visible item.Example
// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;// Make sure the focus is set to the list view control.
pmyListCtrl->SetFocus();// Select all of the items that are completely visible.
int n = pmyListCtrl->GetTopIndex();
int nLast = n + pmyListCtrl->GetCountPerPage();for (;n < nLast;n++)
{
pmyListCtrl->SetItemState(n, LVIS_SELECTED, LVIS_SELECTED);
ASSERT(pmyListCtrl->GetItemState(n, LVIS_SELECTED) == LVIS_SELECTED);
}
Retrieves the index of the topmost visible item when in list view or report view.int GetTopIndex( ) const;
Return Value
The index of the topmost visible item.Example
// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;// Make sure the focus is set to the list view control.
pmyListCtrl->SetFocus();// Select all of the items that are completely visible.
int n = pmyListCtrl->GetTopIndex();
int nLast = n + pmyListCtrl->GetCountPerPage();for (;n < nLast;n++)
{
pmyListCtrl->SetItemState(n, LVIS_SELECTED, LVIS_SELECTED);
ASSERT(pmyListCtrl->GetItemState(n, LVIS_SELECTED) == LVIS_SELECTED);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货