C# ListView with CheckBoxes,多选行时自动选中复选框
我正在使用带有多行和全行选择的 ListView 控件。当我一次选择多行时,我的一些行会神奇地被选中。当将鼠标拖过以及选择一个并按住 Shift 键单击另一个时,会发生这种情况。
请参阅此处描述问题的图片:
葡萄柚发生了什么?有人吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不幸的是,ListView 类中存在错误,这就是其中之一。以下代码是对我有用的修复。
编辑:抱歉,这不太正确,尽管它确实可以防止您在问题中显示的错误。这可以防止选择多个项目,然后通过单击复选框来检查它们。
Unfortunately there are bugs in the ListView class, this is one of them. The following code is a fix that worked for me.
Edit: Sorry, this doesn't work quite right, although it does prevent the error that you show in your question. This prevents selecting multiple items and then checking them by clicking the check box.
我在另一个论坛中回答了这个问题:
http://www.codeproject.com/Messages/3417741/Re-how-to-disable-multi-select-of-checkbox-in-list.aspx
HTH - hground
I answered this in another forum:
http://www.codeproject.com/Messages/3417741/Re-how-to-disable-multi-select-of-checkbox-in-list.aspx
HTH - hground
这是一个简单的问题
试试这个
it`s simple question
just try this