private void treeView2_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (e.Action != TreeViewAction.Unknown)
            {
                CheckAllChildNodes(e.Node, e.Node.Checked);
                //选中父节点 
                bool bol = true;
                if (e.Node.Parent != null)
                {
                    for (int i = 0; i < e.Node.Parent.Nodes.Count; i++)
                    {
                        if (!e.Node.Parent.Nodes[i].Checked)
                            bol = false;
                    }
                    e.Node.Parent.Checked = bol;
                }
            }
        }
        #region  选中子节点
        public void CheckAllChildNodes(TreeNode treeNode, bool nodeChecked)
        {
            foreach (TreeNode node in treeNode.Nodes)
            {
                node.Checked = nodeChecked;
                if (node.Nodes.Count > 0)
                {
                    this.CheckAllChildNodes(node, nodeChecked);
                }
            }
        }
        #endregion

最新文章

  1. 设置label上文字大小、颜色不一样 NSMutableAttributedString的使用
  2. 发布和运行HOLOLENS程序注意这里要勾上,不然就成普通的UWP程序了!
  3. python计算文件的md5值
  4. sql case when then else end
  5. ses_cations 值顺序
  6. 把CMSampleBufferRef转成Data
  7. TSkinData 皮肤控件后最大最小提示英文Close的解决方法
  8. Nginx+PHP-fpm高负载优化及压力测试方法
  9. 关闭ehcache的更新检查UpdateChecker
  10. 【zoj2562】反素数
  11. p标签里面不要放div标签(块元素)
  12. 【STM32学习笔记1】基于固件库的STM32_MDK工程模版
  13. SQL SERVER大话存储结构(3)_数据行的行结构
  14. Python+Selenium webdriver Api
  15. RBAC权限管理模型 产品经理 设计
  16. java----javaBean
  17. [转]VS Code 扩展 Angular 6 Snippets - TypeScript, Html, Angular Material, ngRx, RxJS &amp; Flex Layout
  18. TXB0108 TXS0108E 8-Bit Bidirectional Voltage-Level Translator for Open-Drain and Push-Pull Applications
  19. JMeter学习(二十六)逻辑控制器(转载)
  20. tnsping 命令解析

热门文章

  1. WINFORM时间控件(DATATIMEPICKER)的显示格式设置
  2. oracle11g interval(numtoyminterval())自动创建表分区
  3. CentOS7 Tomcat 环境部署
  4. Lintcode 166. 链表倒数第n个节点
  5. spfa模板
  6. ppmoney 总结二
  7. ExtJS 数据模型
  8. 关于一个parent(),siblings()的小问题
  9. 从零开始---控制台用c写俄罗斯方块游戏(2)
  10. (转)java自带线程池和队列详细讲解 - CSDN过天的专栏