CListCtrl::GetTopIndex
擷取最頂端可見項目的索引,而在 [清單] 檢視或 [報表檢視。
int GetTopIndex( ) const;
傳回值
最上層的可見項目的索引。
範例
// Make sure the focus is set to the list view control.
m_myListCtrl.SetFocus();
// Select all of the items that are completely visible.
int n = m_myListCtrl.GetTopIndex();
int nLast = n + m_myListCtrl.GetCountPerPage();
for (; n < nLast; n++)
{
m_myListCtrl.SetItemState(n, LVIS_SELECTED, LVIS_SELECTED);
ASSERT(m_myListCtrl.GetItemState(n, LVIS_SELECTED) == LVIS_SELECTED);
}
需求
Header: afxcmn.h