System.Windows.Forms.TreeView.ImageIndex Property

Gets or sets the image-list index value of the default image that is displayed by the tree nodes.

Syntax

[System.ComponentModel.Localizable(true)]
[System.ComponentModel.Editor("System.Windows.Forms.Design.ImageIndexEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))]
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.NoneExcludedImageIndexConverter))]
[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
[System.Windows.Forms.RelatedImageList("ImageList")]
[System.ComponentModel.DefaultValue(-1)]
public int ImageIndex { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

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

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

Note:

When setting the TreeView.ImageIndex property at run time, the System.Windows.Forms.TreeView handle is recreated (see Control.RecreateHandle) to update the control's appearance. This causes all tree nodes to be collapsed, with the exception of the selected System.Windows.Forms.TreeNode.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0