tags:

views:

71

answers:

2

Hello all

I want to make in a TreeView (winforms) that each node will have in it a checkbox and two icons and text. How I can implement this thing ? I am really a newbie c# programmer. I have found this two that helped me to understand.

treeNode treeView but how I can show my icons and check box one near another shifter little bit in X dimension?

Can you help me with some example how that thing can be implemented.

Thanks for help.

+1  A: 

Customizing a tree view is not for the feint of heart. But you're lucky, this project does exactly what you are asking for.

Hans Passant
A: 

You can check out the IntegralUI TreeView control. It has options to place different objects like: text, images, check boxes, hyperlinks, even custom controls in single node and arrange them in custom layouts. By using XML tags, much similar to using HTML code, you can create custom layouts of these objects.

For example to place "a checkbox and two icons and text" like you suggest, this would be one solution:

CheckBox ctrlCheck = new CheckBox();
ctrlCheck.Size = new Size(16, 16);
node.Controls.Add(ctrlCheck);
node.Content = "<div><control index=\"0\"></control><img index=\"0\"></img><img index=\"1\"></img> Some text</div>";
this.treeView1.Nodes.Add(node);

assuming that the TreeView has ImageList properties with two images in it.

Even better is if you arrange these objects in table layout. In this example text is docked to the right side of the node:

CheckBox ctrlCheck = new CheckBox();
ctrlCheck.Size = new Size(16, 16);
node.Controls.Add(ctrlCheck);
node.Content = "<div><table width=\"100%\"><tr><td><control index=\"0\"></control></td><td width=\"40\"><img index=\"0\"></img><img index=\"1\"></img></td><td width=\"100%\" style=\"align:middleright\"> Some text</td></tr></table></div>";
this.treeView1.Nodes.Add(node);
Lokey