TreeView Node Color

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
 
A

ahmed.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
 
H

Herfried K. Wagner [MVP]

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.
 
A

ahmed.maryam

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
 

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

Top