CListCtrl::SetItemCount

一个列表视图控件用于添加大量项做好准备。

void SetItemCount(
   int nItems 
);

参数

  • nItems
    控件最终包含项的数目。

备注

若要设置虚拟的项计数列表视图控件,请参见 CListCtrl::SetItemCountEx

备注

此成员函数实现Win32宏,ListView_SetItemCount的行为,如 Windows SDK所述。

示例

        CString str;

        // Add 1024 items to the list view control.
        m_myListCtrl.SetItemCount(1024);

        for (int i = 0; i < 1024; i++)
        {
            str.Format(TEXT("item %d"), i);
            m_myListCtrl.InsertItem(i, str);
        }

要求

Header: afxcmn.h

请参见

参考

CListCtrl选件类

层次结构图

CListCtrl::GetItemCount

CListCtrl::GetSelectedCount