Me.UltraTree1.Override.NodeAppearance.Image = 0
This topic will describe how to have nodes in a WinTree™ that show an image, and make that image change when the node is Expanded.
This can be done with or without an ImageList control.
Add an ImageList to your form, and add at least two images to it. For the purposes of simplicity, the collapsed image will be referred to as image 0 and the expanded image will be image 1.
Then, you need to attach the ImageList to the UltraTree.
To do this, select the UltraTree control on the form, and find the ImageList Property.
Drop down the list and choose the appropriate ImageList control.
Go to the Load event of the Form.
This code will set the image of every node in the tree. This will be the collapsed image.
In Visual Basic:
Me.UltraTree1.Override.NodeAppearance.Image = 0
In C#:
this.ultraTree1.Override.NodeAppearance.Image = 0;
Next, you must apply the expanded image to the nodes. You can do this by using the ExpandedNodeAppeance of the Override .
In Visual Basic:
Me.UltraTree1.Override.ExpandedNodeAppearance.Image = 1
In C#:
this.ultraTree1.Override.ExpandedNodeAppearance.Image = 1;
Run the program.
All the nodes in the UltraTree will show the collapsed image by default.
If any nodes are expanded, they will show the expanded image.
Expand a node and the node’s image will change to the expanded image.
Collapse a node and it will show the collapsed image.