C#.Net TreeView question

J

Jason Huang

Hi,

In the C#.Net 2.0, in a TreeView, I have 3 childnodes, Node1, Node2, Node3.
What do I need to do so whenever I click Node1 the Node1's color will change
to grey?
Thanks for help.


Jason
 
A

Alex Meleta

Hi Jason,

Seems WinForms. Use NodeMouseClick event to get access to clicked node, then
use its properties for changing. In your case it's Node.BackColor = Color.Gray


Regards, Alex
[TechBlog] http://devkids.blogspot.com
 
D

Duggi

Hi,

In the C#.Net 2.0, in a TreeView, I have 3 childnodes, Node1, Node2, Node3..
What do I need to do so whenever I click Node1 the Node1's color will change
to grey?
Thanks for help.

Jason


I think you can use the following in AfterSelect event of treeview.

treeView1.SelectedNode.ForeColor = Color.Red; //whatever the colors
you like
treeView1.SelectedNode.BackColor = Color.Gray; //whatever the colors
you like

-Cnu
 

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