我怎样才能关闭treeview的崩溃属性

时间:2022-01-18 10:54:19

I m working on windows project with c#. I want to close collapse property of treeview when i m double clicking on the nodes.

我用c#在windows项目上工作。我想在双击节点时关闭treeview的崩溃属性。

1 个解决方案

#1


Your question is a little unclear, but do you want to collapse treeview nodes when double clicking on them? If som the following snippet might be of use (assume "tv" is the treeview in question)

你的问题有点不清楚,但是你想双击它们时折叠树视图节点吗?如果som下面的代码片段可能有用(假设“tv”是有问题的树视图)

tv.NodeMouseDoubleClick += delegate(object sender, TreeNodeMouseClickEventArgs e)
{
    if (e.Node.IsExpanded)
        e.Node.Collapse();
    else
        e.Node.Expand();
};

This collapses the tree node on double click if it is expanded, and expands it if it was collapsed.

如果树节点展开,则会在双击时折叠树节点,如果折叠,则展开它。

#1


Your question is a little unclear, but do you want to collapse treeview nodes when double clicking on them? If som the following snippet might be of use (assume "tv" is the treeview in question)

你的问题有点不清楚,但是你想双击它们时折叠树视图节点吗?如果som下面的代码片段可能有用(假设“tv”是有问题的树视图)

tv.NodeMouseDoubleClick += delegate(object sender, TreeNodeMouseClickEventArgs e)
{
    if (e.Node.IsExpanded)
        e.Node.Collapse();
    else
        e.Node.Expand();
};

This collapses the tree node on double click if it is expanded, and expands it if it was collapsed.

如果树节点展开,则会在双击时折叠树节点,如果折叠,则展开它。