在一个有三万多个Item的ListCtrl中,以Report的发式显示。
  现在实现通过单击Header对该列进行排序,通过引用 ListView_SortItems
  实现排序,并且定义了回调函数
  int CALLBACK listCompare( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort )   但是单击Header进行排序后,速度特别慢,要30秒左右。   各位大虾有没有提高这个排序速度的办法!   谢谢各位,解决后大力散分!

解决方案 »

  1.   

    3万多,光是显示也要一段时间,问题不是出在显示上。
    考虑一下能否分段显示吧~只显示前100条,内存中存放所有记录,排序可用快排等,取前一百条加到listctrl中.
      

  2.   

    To:MZP(mzp)    因为用户有可能选择所有的记录,分段显示可以实现吗?
      

  3.   

    分段显示吧,或用Virtual ListCtrl,这个快
      

  4.   


     To:oyljerry(☆勇敢的心☆-Paper Writing)    用Virtual ListCtrl,这个快
       
       能具体说明吗?   谢谢!
      

  5.   

    Creating a virtual list isn't much harder than creating an ordinary CListCtrl. Add a list control in the resource editor as you usually do. Then check the style "Owner data", and then add a CListCtrl variable for this control. The only difference from an ordinary CListCtrl is the "Owner data" (LVS_OWNERDATA) style.http://www.codeproject.com/listctrl/virtuallist.asp#virtual
    很好的解决方法
    谢谢oyljerry(☆勇敢的心☆-Paper Writing)
      

  6.   

    显示的时候,楼住的耗时不大吗?
    我也做过,不过对于几千的数据,显示就需要几秒钟。不过排序倒是满快的。你是不是排序后又重新刷新了list亚,从头又写了一次阿关注