Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 c# 处理 windows 项目。当我双击节点时,我想关闭树视图的折叠属性。
您的问题有点不清楚,但是您想在双击树视图节点时折叠它们吗?如果以下代码段可能有用(假设“tv”是有问题的树视图)
tv.NodeMouseDoubleClick += delegate(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.IsExpanded) e.Node.Collapse(); else e.Node.Expand(); };
如果树节点展开,这会在双击时折叠树节点,如果它被折叠则展开它。