我用clistctrl显示接收到的数据。在不同的时间段内容(包括标题)不同。我希望在显示下一个不同的内容时,将以前clistctrl内容全部清空,标题也更新。
不知是否有“清空”的函数?

解决方案 »

  1.   

    pmyListCtrl->DeleteAllItems();
      

  2.   

    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);
      

  3.   

    m_list.DeleteAllItems();//首先清空listview 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);
    }m.list为你的控件变量。这段代码可以帮助你清空所有
      

  4.   

    清空内容:
    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);
    }
      

  5.   

    m_list.DeleteAllItems();
    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);
    }
      

  6.   

    清空内容:m_list.DeleteAllItems();清空column可按上面几位说的做
      

  7.   

    两次循环即可May you succeed!