当然,可以在您原代码的基础上:
For Each nd As WinForm.TreeNode In trv.AllNodes '遍历所有节点
If nd.Level = 0 Then '如果是二级节点
nd.Text = nd.text & " " & nd.DataRow("员工姓名")
nd.IconFile= ProjectPath & "Images\bossA.ico"
End If
If nd.Level = 1 Then '如果是二级节点
nd.Text = nd.text & " " & nd.DataRow("员工姓名")
nd.IconFile= ProjectPath & "Images\bossB.ico"
End If
If nd.Level = 2 Then '如果是二级节点
nd.Text = nd.text & " " & nd.DataRow("员工姓名")
nd.IconFile= ProjectPath & "Images\bossC.ico"
End If
'……
Next
总之,您需要从0级节点开始,对所有节点指定图标!
[此贴子已经被作者于2013-12-3 12:11:01编辑过]