TreeView Node Color

  • Thread starter Thread starter ahmed.maryam
  • Start date Start date
A

ahmed.maryam

Hi there,

I'm a newbie to C#. I was wondering how I can change the individual
color of nodes in my TreeView control which I'm using to read in an
XML file. Any ideas?

Thanks!

~ Maryam
 
Hi Bryan,

Did you mean forecolor? Setting the forecolor property changes the
color of all the nodes in the treeview, I was wondering how I can
access each node individually ie. have lots of different colored
nodes. Any ideas?

Thanks!

~ Maryam
 
Did you mean forecolor? Setting the forecolor property changes the
color of all the nodes in the treeview, I was wondering how I can
access each node individually ie. have lots of different colored
nodes. Any ideas?

Instead of setting the control's 'ForeColor' and 'BackColor' properties, set
those of the individual 'TreeNode' objects.
 
Hi Herfried,

Thanks for your response, that is exactly what I am trying to
accomplish but I'm not sure how to access the individual color
properties of each TreeNode object. I tried
"TreeNode.Forecolor.Equals("Green")" or something like that but it
doesn't work. I think I just have the syntax wrong, any ideas? Thanks!

~ Maryam
 
Back
Top