System.Windows.Forms.ListViewItem.ImageIndex Property

Gets or sets the index of the image that is displayed for the item.

Syntax

[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.NoneExcludedImageIndexConverter))]
[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
[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.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.DefaultValue(-1)]
public int ImageIndex { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The value of this property depends on the value of the ListViewItem.ImageList property. Depending on the current value of the ListView.View property of the System.Windows.Forms.ListView control associated with the item, the System.Windows.Forms.ImageList used by the item could be one specified in the ListView.LargeImageList property or the ListView.SmallImageList property of the System.Windows.Forms.ListView control. If the ListView.View property is set to View.LargeIcon, the System.Windows.Forms.ImageList specified in the ListView.LargeImageList property is used; otherwise, the System.Windows.Forms.ImageList specified in the ListView.SmallImageList property is used. The images defined in the System.Windows.Forms.ImageList specified in the ListView.SmallImageList should have the same index positions as the images in the System.Windows.Forms.ImageList specified in the ListView.LargeImageList property. If the index positions are the same for both System.Windows.Forms.ImageList controls, you can set a single index value for the ListViewItem.ImageIndex property and the appropriate image will be displayed regardless of the value of the ListView.View property of the System.Windows.Forms.ListView control. The ListViewItem.ImageKey and ListViewItem.ImageIndex properties are mutually exclusive, meaning if one is set, the other is ignored. Furthermore, if you set the ListViewItem.ImageKey property, the ListViewItem.ImageIndex property is automatically set to -1. Alternatively, if you set the ListViewItem.ImageIndex property, the ListViewItem.ImageKey is automatically set to an empty string ("").

Requirements

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