TreeView的节点可以有中间状态的检查? [英] Can TreeView nodes have intermediate checked states?

查看:117
本文介绍了TreeView的节点可以有中间状态的检查?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面就是我希望做的:


  • 表示一组选项,按类别划分。

  • 允许用户检查/检查/取消选中类节点取消一个类别中的所有项目。

  • 显示该类别中的某些选项设置类别节点到中间选中状态检查。

这是我读过,我与的TreeView经验有限,这最后的希望不出现可能的,因为树节点不要不像是会支持比开/关状态检查任何其他。这可能使用一个TreeView?有一些其他的控制,可以拉动这一关,还是我将不得不做出一个子类的TreeView来完成它?

From what I've read, and my limited experience with TreeViews, this last desirable doesn't appear possible, as TreeNodes don't seem to support anything other than a on/off checked state. Is this possible using a TreeView? Is there some other control that could pull this off, or am I going to have to make a sub-class of TreeView to get it done?

推荐答案

可以使用DrawMode属性这样做,你可以用ControlPaint.DrawCheckBox画你自己的复选框()。您还必须实现MouseDown事件并使用的HitTest方法来检测假冒复选框,点击。没有巨大的喜悦,但它是可能的。

It can be done by using the DrawMode property so you can paint your own check box with ControlPaint.DrawCheckBox(). You'll also have to implement the MouseDown event and use the HitTest method to detect clicks on the fake checkbox. No great joy, but it's possible.

这篇关于TreeView的节点可以有中间状态的检查?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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