想要实现目录树中如果有未处理的流程,即带括号()的,其所在的节点就自动展开,否则收缩,效果如下图:
此主题相关图片如下:qq截图20130206-1.jpg
运用了如下代码:
'展开有审批记录的目录树
For Each nd As winform.treenode In tr.allNodes
If nd.level = 1 Then
Dim i As Integer = 1
For Each nd1 As WinForm.TreeNode In nd.Nodes
If nd1.text Like "*(*" Then
i = i + 1
End If
Next
If i > 1 Then '展开节点及其父节点
nd.expand()
nd.ParentNode.expand()
ElseIf i = 1 Then '收缩节点及其父节点
nd.Collapse()
nd.ParentNode.Collapse()
End If
End If
Next
但遍历后只能展开最后一个符合要求的节点,以前的自动收缩掉了,如下图
此主题相关图片如下:qq截图20130206-2.jpg
请教各位老师要如何才能避免这种情况?
谢谢!
[此贴子已经被作者于2013-2-26 15:51:06编辑过]