TreeNode.ImageIndex Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the image list index value of the image displayed when the tree node is in the unselected state.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[<TypeConverterAttribute(typeof(TreeViewImageIndexConverter))>]
[<RelatedImageListAttribute("TreeView.ImageList")>]
member ImageIndex : int with get, set

Property Value

Type: System.Int32

A zero-based index value that represents the image position in the assigned ImageList.

The ImageIndex value is the index value of an Image stored in the ImageList assigned to the TreeView.ImageList property.

System_CAPS_noteNote

The default value of the ImageIndex property is the same as the ImageIndex property of the TreeView control that the TreeNode is assigned to.

The ImageKey and ImageIndex properties are mutually exclusive; therefore, if one property is set, the other is ignored. If you set the ImageKey property, the ImageIndex property is automatically set to -1. Alternatively, if you set ImageIndex, ImageKey is automatically set to an empty string ("").

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 is displayed when the tree node is 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. It also requires that the Customer and Order objects are defined.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: