google da aradım adam gibi yapan birini bulamadım yok dictionary kullananlar hash yapanlar 12 saatimi aldı. Oturdum 15 dakkada kendim yaptım, bu da ayrı bi delirme nedeni.
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim SendTree As New TreeNode
SendTree.Nodes.Clear()
CopyExpandeds(SendTree.Nodes, treeView1.Nodes)
'... reloading code u ...
SendExpandeds(treeView1.Nodes, SendTree.Nodes)
'SendExpandeds(treeView1.Nodes, SendTree.Nodes(0))
Dim tmpNode As New TreeNode
SendTree = tmpNode
End Sub
Private Sub CopyExpandeds(ByVal CopyTree As TreeNodeCollection, ByVal SourceTree As TreeNodeCollection)
If SourceTree Is Nothing Then
Exit Sub
End If
For Each Sn As TreeNode In SourceTree
Dim n As New TreeNode
n.Name = Sn.Name
If Sn.IsExpanded Then
n.Expand()
' T ve F ler şart değil, T and F not require
'Kopyalama ve test amaçlı
n.Text = "T"
Else
n.Collapse()
n.Text = "F"
End If
CopyTree.Add(n)
CopyExpandeds(n.Nodes, Sn.Nodes)
Next
End Sub
Sub SendExpandeds(ByVal TargetTree As TreeNodeCollection, ByVal sourcetree As TreeNodeCollection)
If sourcetree Is Nothing Then
Exit Sub
End If
For Each Sn As TreeNode In sourcetree
If Sn.IsExpanded Then
TargetTree.Item(Sn.Index).Expand()
Else
'TargetTree.Item(Sn.Index).Collapse()
End If
SendExpandeds(TargetTree.Item(Sn.Index).Nodes, Sn.Nodes)
Next
End Sub
vb, visual basic
Hiç yorum yok:
Yorum Gönder