简体   繁体   English

CListCtrl中的向上和向下图标

[英]Up and Down icons in CListCtrl

I have a CListCtrl with multiple columns, all of which are able to be sorted by. 我有一个带有多个列的CListCtrl,所有这些列都可以排序。 I would like to add up and down icons so that it is clear which column is currently sorted upon, and in which direction; 我想补充的向上向下的图标,这样非常清晰,列目前已在排序,在哪个方向; much like Windows Explorer. 非常类似于Windows资源管理器。 My thought was to add a solid up/down arrow to the column name. 我的想法是在列名称中添加一个向上/向下的实心箭头。 I tried using the extended ASCII chars 30/31; 我尝试使用扩展的ASCII字符30/31; but instead of showing the arrows, I got boxes (the "character not found" character); 但是我没有显示箭头,而是得到了方框(“找不到字符”字符); and using the unicode version, I got a question mark instead of the character. 并使用unicode版本,我得到了一个问号而不是字符。

Any suggestions as to how I could accomplish this? 关于如何完成此工作的任何建议?

You can use the newer CMFCListCtrl class or the CMFCHeaderCtrl class. 您可以使用较新的CMFCListCtrl类或CMFCHeaderCtrl类。 There, you can set the sort column and the sort direction. 在那里,您可以设置排序列和排序方向。

Try 尝试

myListCtrl.SetSortColumn(nCol, bAscending);

or 要么

CMFCHeaderCtrl &headerCntrl = myListCtrl.GetHeaderCtrl();
headerCntrl.SetSortColumn(nCol, bAscending);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM