在 CheckedListBox 中用鼠标设置不确定状态
我需要一些帮助,但我正在用头撞墙。我有一个使用三态 CheckedListBox
的应用程序。我将这三种状态用于特定目的:
选中意味着技术执行了操作 未选中意味着技术未执行该操作 不确定意味着技术没有执行该操作,因为这是不必要的。
我需要能够根据需要使用鼠标从“已选中”到“未选中”到“不确定”到“已选中”进行切换。如果我使用 CheckBox
并将 ThreeState
设置为 True
,这正是会发生的情况,但似乎设置的唯一方法CheckedListBox
中的不确定状态是通过代码实现的。
有人可以告诉我该怎么做吗?令我难以置信的是,它不是一个可以像在 CheckBox
中那样设置的属性。
我认为让我困惑的是以前似乎没有人需要这个功能。我在谷歌上没有找到任何关于如何做到这一点或提出这个问题的信息。
I need some assistance and I'm beating my head against the wall. I have an application that uses a tri-state CheckedListBox
. I use the three states for specific purposes:
Checked means tech performed an action
Unchecked means the tech didn't perform the action
Indeterminate means that the tech didn't perform the action because it was unnecessary.
I need to be able toggle, with the mouse from Checked to Unchecked to Indeterminate to Checked as necessary. If I were using a CheckBox
and ThreeState
were set to True
, this is exactly what would happen, but it appears that the only way to set the Indeterminate state in the CheckedListBox
is through code.
Could someone give me an idea of what to do? It boggles my mind that it's not a Property you can set like you can in CheckBox
.
I think what throws me is that no one seems to have needed this functionality before. I have found nothing on Google about how one might do this, or asking the question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为控件中没有属性来控制此行为,但在代码中很容易实现:
I don't think that there is a property in the control to control this behavior, but it is easy to implement in code:
我将所提供的建议从 C# 翻译成 VB,如下所示,
效果非常好。我发誓我尝试过类似的事情,但我没有做对。但这有效。非常感谢。就这么简单。有一天我会解决这个问题。自学包括提出一个想法并进行挖掘,直到找到线索。
I translated the offered suggestion from C# to VB as follows
Worked like a charm. I would have sworn I tried something similar to that, but I didn't get it right. But this worked. Thank you so very much. So simple. Someday I'll figure this out. Teaching myself consists of coming up with an idea and digging around until I find a clue.