StateImageIndex Property

ListViewItem.StateImageIndex Property

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

[Visual Basic]
Public Property StateImageIndex As Integer
public int StateImageIndex {get; set;}
public: __property int get_StateImageIndex();
public: __property void set_StateImageIndex(int);
public function get StateImageIndex() : int;
public function set StateImageIndex(int);

Property Value

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


Exception Type Condition
ArgumentOutOfRangeException The value specified for this property is less than -1.


The value specified for this property is greater than 14.


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 checked or cleared check box or an image that is intended to represent checked or unchecked states for the item. If no value is specified for the StateImageList property, the ListView control displays a default checked 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 lower than 14, only the images at index positions 0 and 1 are displayed as state images.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ListViewItem Class | ListViewItem Members | System.Windows.Forms Namespace | ListView.StateImageList

© 2015 Microsoft