老师,有一个逻辑没理清楚,收缩后的一级节点,图标都为"图标一",应该在哪儿绘制?
If (e.State And System.Windows.Forms.TreeNodeStates.Selected) <> 0 Then
e.Graphics.FillRectangle(Brushes.SkyBlue, Rectangle.Inflate(e.Bounds, 100, 0)) '二级节点背景色
e.Graphics.DrawString(e.Node.Text, nodeFont, Brushes.Red, e.Bounds.Left + 2,e.Bounds.top + 8) '字体色
e.Graphics.DrawImage(getImage("图标四.png"),e.Bounds.Left - 18,e.Bounds.top + 8 ,16,16)
Else
e.Graphics.DrawString(e.Node.Text, nodeFont, Brushes.Black, e.Bounds.Left + 2,e.Bounds.top + 8) '字体色
Dim nd = sender.Selectednode
e.Graphics.DrawImage(GetImage("图标二.png"),e.Bounds.Left - 18,e.Bounds.top + 8 ,16,16)
If nd IsNot Nothing Then
If nd.FullPath Like "*" & e.Node.text & "*" Then
e.Graphics.FillRectangle(Brushes.DeepSkyBlue, Rectangle.Inflate(e.Bounds, 100, 0)) '一级节点背景色
e.Graphics.DrawString(e.Node.Text, nodeFont, Brushes.Red, e.Bounds.Left + 2,e.Bounds.top + 8) '字体色
e.Graphics.DrawImage(GetImage("图标三.png"),e.Bounds.Left - 18,e.Bounds.top + 8 ,16,16)
End If
End If
End If