Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Treeview control  (Read 745 times)

0 Members and 1 Guest are viewing this topic.

Lucy Douglas

  • Guest
Treeview control
« on: December 15, 2008, 03:00:01 PM »
I downloaded the trial version of the treeview and it doesn't seem to be fully functional. Is there a way to change the icons and properties?
« Last Edit: December 15, 2008, 05:04:09 PM by Ruslan »

Ruslan

  • Flexible TreeView Team
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 569
Re: Treeview control
« Reply #1 on: December 15, 2008, 05:27:56 PM »
Hello, Lucy.

Welcome and thank you for your interest to the Flexible TreeView.

The trial version is fully functional but there`s a leak of documentation topics on how to use all features.
Now we hardly working on the Knowledge Base where anyone can find useful explanations on how to use the Flexible TreeView in action.

About your question:
- What icons do you want to change?

- Now I`ll explain shortly of how to use Flexible TreeView (FTV) from the scratch to show
some icons (related to your question):

First and general thing in FTV is a node class where all data will be stored. The FTV`s Node class stores a general info like some text (Text property), check state (CheckState) etc. So if you want to show some images in the treeview, you need to derive your own node class from the Node class (if you need to show more than a text and an image) OR use the built-in NodeWithImage class (if you need to show only a text and an image).

So lets imagine that we need to show some image (icon) and a text right after that.
1) We`ll use built-in NodeWithImage class because we don`t have additional data to show.
2) Now we should construct the treeview to show our data so:
- drop on the form the Flexible TreeView from the VS`s Toolbox
- open node controls designer (select the tree -> VS Properties Window -> NodeControls property)
- click the 'Add' drop down button on the opened editor form and select NodeImage. New node control should appear in the list at the left side.
- add NodeTextBox the same way. Note that the order of the node controls is the order of a data that we want to show in our treeview!
- now we have two node controls that will show a data from the node class`s Text and Image properties.
3) Now we should construct the treeview`s content by filling it up by nodes.
For instance we`ll add ten nodes:
Code: [Select]
NodeWithImage node;

for(int i=0;i<10;i++)
{
   node = new NodeWithImage();
   // Note that here you can assign any image for showing in every separate node.
   node.Image = Resources.SomeIcon; // you should add a 'SomeIcon' image to the project`s resources.
   node.Text = "Node #"+i.ToString();
   // here we are attaching our new node to the treeview`s root.
   node.Attach(tree);
}

That`s. Now hit F5 and you should see our ten nodes with the icon and text (see attached picture).
Please review the attached example project for details.

If you have any question feel free to ask here.

------------------------------------------------
Best regards,
  Flexible TreeView Support Team
« Last Edit: December 16, 2008, 12:19:30 AM by Ruslan »
 

Copyright © 2006-2012 ARMSoft. All rights reserved.