Q: BackColor

  • Thread starter Thread starter Geoff Jones
  • Start date Start date
G

Geoff Jones

Hiya

If a node of a TreeView has had its ForeColor set to something different
than its default, is there an easy way to change it back without knowing
which node it was i.e. is there a command to reset all the nodes back to the
default color?

Geoff
 
I think that not, but you can make easily a recursive function using
TreeView.Nodes and Node.Nodes.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 
Geoff,

Geoff Jones said:
If a node of a TreeView has had its ForeColor set to something different
than its default, is there an easy way to change it back without knowing
which node it was i.e. is there a command to reset all the nodes back to
the default color?

\\\
Private Sub RecurseNodes(ByVal col As TreeNodeCollection)
For Each tn As TreeNode In col
tn.ForeColor = ...
If tn.Nodes.Count > 0 Then
RecurseNodes(tn.Nodes)
End If
Next tn
End Sub

Private Sub Test()
RecurseNodes(Me.TreeView1.Nodes)
End Sub
///
 
Thanks Guys

Herfried K. Wagner said:
Geoff,



\\\
Private Sub RecurseNodes(ByVal col As TreeNodeCollection)
For Each tn As TreeNode In col
tn.ForeColor = ...
If tn.Nodes.Count > 0 Then
RecurseNodes(tn.Nodes)
End If
Next tn
End Sub

Private Sub Test()
RecurseNodes(Me.TreeView1.Nodes)
End Sub
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top