Edit

Share via


ListViewItem.StateImageIndex Property

Definition

Gets or sets the index of the state image (an image such as a selected or cleared check box that indicates the state of the item) that is displayed for the item.

public:
 property int StateImageIndex { int get(); void set(int value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ImageIndexConverter))]
public int StateImageIndex { get; set; }
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.NoneExcludedImageIndexConverter))]
[System.Windows.Forms.RelatedImageList("ListView.StateImageList")]
public int StateImageIndex { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ImageIndexConverter))>]
member this.StateImageIndex : int with get, set
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.NoneExcludedImageIndexConverter))>]
[<System.Windows.Forms.RelatedImageList("ListView.StateImageList")>]
member this.StateImageIndex : int with get, set
Public Property StateImageIndex As Integer

Property Value

The zero-based index of the state image in the ImageList that is displayed for the item.

Attributes

Exceptions

The value specified for this property is less than -1.

-or-

The value specified for this property is greater than 14.

Remarks

This property allows you to specify the index into the ImageList assigned to the StateImageList property of the associated ListView control, where the state images to display to the left of the item are stored. Typically, the state image is a selected or cleared check box or an image that is intended to represent selected or cleared states for the item. If no value is specified for the StateImageList property, the ListView control displays a default selected or cleared check box when the CheckBoxes property of the control is set to true.

Note

Although the ImageList specified in the StateImageList property can contain any number of images, and the StateImageIndex property can be set to any value equal to or lower than 14, only the images at index positions 0 and 1 are displayed as state images.

Applies to

See also