I have included a treeview in my windows form in VC++.NET project. I have nearly 10,000 nodes in the tree. I wanted to know whether it is possible to control some of the nodes in this. To be more clear.. I have a button and when i press the button (for example) I want some of the nodes to change its forecolor or something like that. Is this possible?? Please help me ...I m in real trouble and need to solve this problem.
Thanks a lot
Tree view control in VC++ .NET
Started by scorpionguy, May 23 2006 09:23 PM
5 replies to this topic
#1
Posted 23 May 2006 - 09:23 PM
#2
Posted 23 May 2006 - 09:48 PM
http://msdn.microsof...tcntrlsamp3.asp
http://msdn2.microso...y/sc9ba94b.aspx
http://msdn.microsof...mortreenode.asp
http://msdn2.microso...y/haf2a2zb.aspx
The MSDN is your friend
http://msdn2.microso...y/sc9ba94b.aspx
http://msdn.microsof...mortreenode.asp
http://msdn2.microso...y/haf2a2zb.aspx
The MSDN is your friend
reedbeta.com - developer blog, OpenGL demos, and other projects
#3
Posted 23 May 2006 - 10:55 PM
Can anybody tell how to access a particular node in the tree(not the node clicked by the user).particular node here means referring a node by name
#4
Posted 24 May 2006 - 12:54 AM
The problem with that is that your node names are not unique, so there may be more than one node with the same name.
Your best bet is to manually walk through each and every node inside the treeview, retrieving the associated node item data, and manually comparing the node string and the desired text.
Cheers,
- Wernaeh
Your best bet is to manually walk through each and every node inside the treeview, retrieving the associated node item data, and manually comparing the node string and the desired text.
Cheers,
- Wernaeh
Some call me mathematician, some just call me computer guy. Yet, I prefer the term professional weirdo :)
#5
Posted 24 May 2006 - 05:16 AM
scorpionguy, if you sure that names of all nodes in TreeView are unique, then you can iterate through all nodes of the TreeView recursive and find node by name; or better to use node path, in case if parent node and its child has same name.
10% luck, 20% skill, 15% concentrated power of will, 5% pleasure, 50% pain
and 100% reason to remember the name
My Weblog "Project Delta" » http://project-delta.blogspot.com/
#6
Posted 24 May 2006 - 07:28 AM
If your node has a lot of elements in it (say, more than a few dozen), this linear search strategy will be inefficient...in that case, you could keep an std::map (or whatever the equivalent class is in .NET) with names as the keys and references to TreeView nodes as the values. Then you would get logarithmic-time lookup.
reedbeta.com - developer blog, OpenGL demos, and other projects
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











