If e.Node.ParentNode IsNot Nothing AndAlso e.Node.Checked Then '勾选子节点时
e.Node.ParentNode.Checked = True '勾选父节点(因为具有子权限就必定具有父权限)
End If
If e.Node.Checked = False '如果取消勾选父节点
For Each cnd As WinForm.TreeNode In e.Node.Nodes '遍历节点集合
Functions.Execute("setChildren",cnd )
Next
End If
添加一个内部函数setChildren
Dim nd As WinForm.TreeNode = args(0)
For Each cnd As WinForm.TreeNode In nd.Nodes '遍历节点集合
cnd.Checked = False '取消勾选子节点,因为取消父权限就必定没有子权限
Functions.Execute("setChildren",cnd )
Next