双击 TreeNode 复选框上的行为
我有一个 TreeView
,其中填充了带有图标和复选框的 TreeNodes
。
我一直在尝试禁用其中一些在 BerforeCheck
方法中丢弃事件的检查/取消检查功能。这工作正常,直到我双击复选框:复选框的图像与其真实状态相反(如果状态为 Checked=false
,它会显示一个复选标记)。我尝试修复在 NodeDoubleClick 和 BeforeClick 方法中手动更改 StateImageIndex 的问题,但没有成功。
更糟糕的是:我在 StateImageList 中添加了第三个图像(是的,我也希望复选框为三态),但我还没有使用它(它从未在我的代码中设置),并且第三张图像在双击后设置为框的当前状态(此时我无法确定明确的行为)。
我怎样才能最好地使其按预期工作,最坏地禁用双击复选框? 谢谢。
PS:该问题已被问过,但没有答案。 ..
I have a TreeView
populated with TreeNodes
having icons and checkboxes.
I've been tryig to disable the checkig/unchecking ability of some of them discarding the event in the BerforeCheck
method. This works fine, until I double click on the checkbox: the image of the checkbox is the opposite of its real state (it shows a check mark if the status is Checked=false
). I've tried to fix that changing the StateImageIndex manually in the NodeDoubleClick
and BeforeClick
method with no success.
Even worse: I added a third image in the StateImageList
(yes I want the checkboxes to be tri-state too) but I'm not using it yet (it's never set in my code), and the third image is set as the current state of the box after some double-click (at this point I can't determine a clear behavior).
How can I do to at best make it work as exepected, at worst disable the double-click on the checkbox?
Thanks.
PS: The question has already been asked, but had no answer...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个..:)对我有用
Try this.. :) worked for me