1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
Private Sub tvClassement_AfterExpand(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvClassement.AfterExpand
Dim profondeur As Integer
profondeur = e.Node.Level
'si après l'action Expand, le noeud est ouvert alors
If e.Node.IsExpanded Then
'on lui affecte l'image 5 = icone dossier ouvert
e.Node.ImageIndex = 5
e.Node.SelectedImageIndex = 5
's'il est à une profondeur > 1 alors on fait de meme avec le noeud pere
If profondeur > 1 Then
e.Node.Parent.ImageIndex = 5
e.Node.Parent.SelectedImageIndex = 5
End If
'si le noeud n'est pas ouvert on met l'icone fermé (facultatif)
'Else : e.Node.ImageIndex = 0
End If |