以下是引用blackzhu在2015/11/30 12:27:00的发言:
Dim nms As new List(of String)
Dim nms1 As New List(of String)
Dim str As String
Dim str1 As String
Dim str2 As String
str2 = Tables("角色授权_Table1").Current("角色授权")
If str2 >"" Then
For Each s As String In str2.Split(",")
Dim mc = System.Text.RegularExpressions.Regex.Matches(s, "(.+?[%sS])|(.+$)")
str = str & "," & mc(0).Value.Split(".")(0)
str1 = str1 & "," & mc(0).Value.Split(".")(1)
Next
nms.AddRange(str.Split(","))
nms1.AddRange(str1.Split(","))
End If
For Each nd As WinForm.TreeNode In tv.AllNodes
If nd.Level = 0 Then
nd.Checked = nms.Contains(nd.Name)
Else If nd.Level = 1 Then
nd.Checked = nms1.Contains(nd.Name) And nms.Contains(nd.ParentNode.Name)
End If
Next
tv.ResumeRedraw
当前行不为空的话,目录树根据当前的数据勾选节点,但是为空的时候,也勾选了. 这个不应该呀 我已经判断 str2 必须不为空
[此贴子已经被作者于2015/11/30 12:27:39编辑过]