CListCtrl::DeleteAllItems BOOL DeleteAllItems( );Return ValueNonzero if successful; otherwise zero.ResCall this function to delete all items from the list view control.Example// The pointer to my list view control. extern CListCtrl* pmyListCtrl;// Delete all of the items from the list view control. pmyListCtrl->DeleteAllItems(); ASSERT(pmyListCtrl->GetItemCount() == 0);
清空内容: pListCtrl->DeleteAllItems(); 清空列头: // Pointer to the list view control. CListCtrl* pmyListCtrl;int nColumnCount = pmyListCtrl->GetHeaderCtrl()->GetItemCount();// Delete all of the columns. for (int i=0;i < nColumnCount;i++) { pmyListCtrl->DeleteColumn(0); }
BOOL DeleteAllItems( );Return ValueNonzero if successful; otherwise zero.ResCall this function to delete all items from the list view control.Example// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;// Delete all of the items from the list view control.
pmyListCtrl->DeleteAllItems();
ASSERT(pmyListCtrl->GetItemCount() == 0);
for(i = 0; i < iCount; i++)
{
m_list.DeleteColumn(0);
}
for(i = 0; i < iCount; i++)
{
m_list.GetHeaderCtrl()->DeleteItem(0);
}m.list为你的控件变量。这段代码可以帮助你清空所有
pListCtrl->DeleteAllItems();
清空列头:
// Pointer to the list view control.
CListCtrl* pmyListCtrl;int nColumnCount = pmyListCtrl->GetHeaderCtrl()->GetItemCount();// Delete all of the columns.
for (int i=0;i < nColumnCount;i++)
{
pmyListCtrl->DeleteColumn(0);
}
iCount = m_list.GetHeaderCtrl()->GetItemCount();
for(i = 0; i < iCount; i++)
{
m_list.DeleteColumn(0);
}
for(i = 0; i < iCount; i++)
{
m_list.GetHeaderCtrl()->DeleteItem(0);
}