以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [目录树]如何实现所有子节点的复选框未选,父节点的复选框也变成未选!  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=15071)

--  作者:原来的我
--  发布时间:2011/12/11 21:13:00
--  [目录树]如何实现所有子节点的复选框未选,父节点的复选框也变成未选!
如题!
--  作者:狐狸爸爸
--  发布时间:2011/12/11 21:30:00
--  

设置AfterCheckNode事件:

 

 

If e.node.Nodes.count > 0 Then
    Dim cnt As Integer
    For Each nd As WinForm.TreeNode In e.node.Nodes
        If nd.Checked Then
            cnt = cnt + 1
        End If
    Next
    If cnt = 0 Then
        e.node.Checked = False
    End If
End If
Dim pd As WinForm.TreeNode = e.Node.ParentNode
If pd IsNot Nothing Then
    Dim cnt As Integer
    For Each nd As WinForm.TreeNode In pd.Nodes
        If nd.Checked Then
            cnt = cnt +1
        End If
    Next
    If cnt = 0 Then
        pd.Checked = False
    End If
End If