获取从列表控件中选择的项目列表的最快方法. [英] Fastest way to get the list of items selected from a list control.

查看:80
本文介绍了获取从列表控件中选择的项目列表的最快方法.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用基于列表控件 CListCtrl 的MFC开发应用程序.我必须获取在该列表控件中选择的项目的列表.我找到了方法.这就像线性搜索.浏览每个项目并检查选择.

http://www.codeguru.com/forum/showthread.php?t=231220


如果列表控件中的行数增加,则会出现严重的性能问题.还有其他方法可以加快找到所选项目的过程.


谢谢,

[edit]粗体标签移动到相关单词周围-OriginalGriff [/edit]

Hi,

I am developing an application using MFC, based on List Control CListCtrl. I have to get the list of items selected in that list control. I found the way to do. It is like linear search. Going through each item and checking for selection.

http://www.codeguru.com/forum/showthread.php?t=231220


This has serious performance issue if the number of rows in the list control goes up. Is there any other way to speed up the process of finding the selected items.


Thanks,

[edit]Tags, bold moved to around relevant words - OriginalGriff[/edit]

推荐答案

如果为CListCtrl,请使用GetFirstSelectedItemPositionGetNextSelectedItemPosition.这不是线性搜索;您只遍历选定的项目,而不遍历整个列表.请参阅 http://msdn.microsoft.com/zh-CN/library/zdff988k(v = VS.80).aspx [
If this is CListCtrl, use GetFirstSelectedItemPosition and GetNextSelectedItemPosition. This is not linear search; you only traverse selected items, not the whole list. See http://msdn.microsoft.com/en-US/library/zdff988k(v=VS.80).aspx[^].

—SA


这篇关于获取从列表控件中选择的项目列表的最快方法.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆