AfterCheck

        /// <summary>
        /// 树勾选
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tvCourse_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (e.Action ==TreeViewAction.ByMouse)
            {
                if (e.Node.Checked)
                {
                    SetChildNode(e.Node, true);
                    if (null!= e.Node.Parent)
                    {
                        SetParentNode(e.Node, true);
                    }
                    //获取选中节点值
                    lstChapterIds.Add(e.Node.Name);
                    this.btnDelRes.Enabled = true;
                }
                else
                {
                    //取消节点选中状态之后,取消所有父节点的选中状态
                    SetChildNode(e.Node, false);
                    //如果节点存在父节点,取消父节点的选中状态
                    if (e.Node.Parent != null)
                    {
                        SetParentNode(e.Node, false);
                    }
                    //获取选中节点值
                    if (lstChapterIds.Contains(e.Node.Name))
                    {
                        lstChapterIds.Remove(e.Node.Name);
                        if (!lstChapterIds.Any())
                        {
                            this.btnDelRes.Enabled = false;
                        }
                    }
                }
                
            }
        }
AfterCheck

相关文章:

  • 2022-12-23
  • 2021-11-07
  • 2021-10-24
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
  • 2021-12-21
  • 2021-08-19
  • 2022-01-18
相关资源
相似解决方案