Property Value

If the ImageList property value is anything other than null, all the tree nodes display the first Image stored in the ImageList. You can specify which images from the list are displayed for selected and unselected nodes by setting the ImageIndex and SelectedImageIndex properties. Individual TreeNode objects can specify which image is displayed by setting their ImageIndex and SelectedImageIndex properties. These individual settings will override the settings in the corresponding TreeView properties.

The following code example creates and assigns an ImageList to a TreeView control and fills the TreeView control with TreeNode objects. The tree nodes are assigned images from the ImageList that are displayed when in a selected or unselected state. This example requires that you have a Form that contains a TreeView, and an ArrayList that contains Customer objects that each contain Order objects.