AfterExpandNode事件
Dim flag As Boolean = True
For Each nd As WinForm.TreeNode In e.node.nodes
If nd.Nodes.Count > 0 Then
flag = False
End If
Next
If flag Then
For Each nd As WinForm.TreeNode In e.Sender.AllNodes
If e.node.FullName.StartsWith(nd.FullName) = false Then
nd.Collapse
End If
Next
End If