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; } } } } }
时间: 2024-10-20 12:35:41