首页 > 代码库 > Winform TreeView 单选

Winform TreeView 单选

 private void treeView1_AfterCheck(object sender, TreeViewEventArgs e)        {            //通过鼠标或者键盘触发事件,防止修改节点的Checked状态时候再次进入            if (e.Action == TreeViewAction.ByMouse || e.Action == TreeViewAction.ByKeyboard)            {                if (e.Node.Checked)                {                    foreach (TreeNode node in treeView1.Nodes)                    {                        if (node.Name != e.Node.Name)                        {                            node.Checked = false;                        }                    }                }            }        }

 

Winform TreeView 单选