问个简单的小问题
TreeView每个子节点能否依需求改变不同的背景颜色?
试了一下是可以
但是有新问题
这要写个小程序才好说
Private Sub Form_Load() Dim i As Integer Set node1 = TreeView1.Nodes.Add(, , "school", "学校") Set node2 = TreeView1.Nodes.Add(node1.Index, tvwChild, "section", "部门") Set node3 = TreeView1.Nodes.Add(node2.Index, tvwChild, "department", "院系") Set node4 = TreeView1.Nodes.Add(node2.Index, tvwChild, "excute", "行政") Set node5 = TreeView1.Nodes.Add(node2.Index, tvwChild, "logistics", "后勤") For i = 1 To 10 Set node5 = TreeView1.Nodes.Add(node3.Index, tvwChild, "AAA" & i, "电子系" & i) Next i End Sub
For i = 0 To UBound(Selected) If Selected(i) <> "" Then For j = 1 To ProjManagerTreeView.Nodes.Count If (InStr(Selected(i), "True") <> 0) And (ProjManagerTreeView.Nodes(j).Text = Mid(Selected(i), 1, InStr(Selected(i), ",") - 1)) Then ProjManagerTreeView.Nodes(j).BackColor = vbRed End If Next j End If Next i