Button 对 TreeView1 所有节点的全选

protected void Button1_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < this.TreeView1.Nodes.Count; i++)//循环根节点
        {
            if (TreeView1.Nodes[i].Checked == false)//判断是否被选中
            {
                TreeView1.Nodes[i].Checked = true;
                for (int j = 0; j < this.TreeView1.Nodes[i].ChildNodes.Count; j++)//循环当前节点的第一级子节点
                {
                    if (this.TreeView1.Nodes[i].ChildNodes[j].Checked == false)
                    {
                        TreeView1.Nodes[i].ChildNodes[j].Checked = true;
                    }
                }
            }
        }
    } 

上一篇:windows远程桌面连接树莓派


下一篇:在Linux上安装Oracle RAC 12 c(12.1) 虚拟机,一步一步向导