CListCtrl 中的向上和向下图标

发布于 2024-09-09 02:08:55 字数 257 浏览 2 评论 0原文

我有一个包含多列的 CListCtrl,所有列都可以按其排序。我想添加向上向下图标,以便清楚地显示当前按哪一列排序以及按哪个方向排序;很像 Windows 资源管理器。我的想法是在列名称中添加一个实心的向上/向下箭头。我尝试使用扩展 ASCII 字符 30/31;但我没有显示箭头,而是看到了方框(“找不到字符”字符);使用 unicode 版本时,我得到的是问号而不是字符。

关于我如何实现这一目标有什么建议吗?

I have a CListCtrl with multiple columns, all of which are able to be sorted by. 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. My thought was to add a solid up/down arrow to the column name. I tried using the extended ASCII chars 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.

Any suggestions as to how I could accomplish this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

来世叙缘 2024-09-16 02:08:55

您可以使用较新的 CMFCListCtrl 类或 CMFCHeaderCtrl 类。在那里,您可以设置排序列和排序方向。

尝试

myListCtrl.SetSortColumn(nCol, bAscending);

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

You can use the newer CMFCListCtrl class or the CMFCHeaderCtrl class. 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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文