Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2007

Tip: Looking for answers? Try searching our database.

TreeView Node Color

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ahmed.maryam@gmail.com - 13 Mar 2007 01:41 GMT
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
Bryan Phillips - 13 Mar 2007 02:47 GMT
Set the backcolor property of the treenode class.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog:  http://bphillips76.spaces.live.com

> Hi there,
>
[quoted text clipped - 5 lines]
>
> ~ Maryam
ahmed.maryam@gmail.com - 13 Mar 2007 14:27 GMT
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

On Mar 12, 9:47 pm, "Bryan Phillips"
<bphill...@nospam.spamcop.net.spammenot> wrote:
> Set the backcolor property of the treenode class.
>
[quoted text clipped - 16 lines]
>
> > ~ Maryam
Herfried K. Wagner [MVP] - 13 Mar 2007 16:16 GMT
<ahmed.maryam@gmail.com> schrieb:
> 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.

Signature

M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>

ahmed.maryam@gmail.com - 13 Mar 2007 20:30 GMT
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

On Mar 13, 11:16 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.at> wrote:
> <ahmed.mar...@gmail.com> schrieb:
>
[quoted text clipped - 10 lines]
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Bryan Phillips - 13 Mar 2007 22:57 GMT
Use this syntax:

TreeNode.ForeColor = Color.Green;

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog:  http://bphillips76.spaces.live.com

> Hi Herfried,
>
[quoted text clipped - 22 lines]
> > M V P  <URL:http://dotnet.mvps.org/>
> >  V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.