| ||||||||||
IntroductionThis adds sorting to MFC's list control class. Sorting is automatically taken care of: it will sort text, dates and numbers in ascending or descending order, and show an arrow in the appropriate direction in the heading for the sorted column. It also adds some other things that make life easier when using list controls - it is much easier to set the columns and add rows, and it can load and save the column widths. How to use itLook at the example to see how it is used. You need to add the files SortListCtrl.cpp/h and SortHeaderCtrl.cpp/h to your project, then associate a In the e.g. m_ctlList.SetHeadings( _T("Name,120;Date of Birth,90;Score,50") ); Adding rows is very easy, you call the list control's e.g. m_ctlList.AddItem( _T("Mark Jackson"), _T("09/08/1974"), _T("100") ); To remember the columns' widths call the list control's ImplementationIt was a REAL pain to do, your callback function gets the item data for the two rows to compare, but what use is that, you need the text to compare! This control stores the text for the columns in the item data, so the compare function can get at it, it also allows users of the control to use the item data as usual. CreditsThe code for drawing the arrow in the header control was written by Zafir Anjum Mark Jackson
|
Zt一个很好用的sort clistctrl 。
最新推荐文章于 2024-03-27 17:32:09 发布