Export (0) Print
Expand All

ColumnHeader.ImageIndex Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets the index of the image displayed in the ColumnHeader.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public int ImageIndex { get; set; }
/** @property */
public int get_ImageIndex ()

/** @property */
public void set_ImageIndex (int value)

public function get ImageIndex () : int

public function set ImageIndex (value : int)

Property Value

The index of the image displayed in the ColumnHeader.

Exception typeCondition

ArgumentOutOfRangeException

ImageIndex is less than -1.

The ImageIndex property refers to the index of an image specified by the SmallImageList property of the ListView that contains the ColumnHeader. The ImageIndex property returns -1 if there is no SmallImageList set on the containing ListView. The image displayed in a column is typically used to indicate the state of items in the column.

ImageKey and ImageIndex are mutually exclusive, meaning if one is set, the other is set to an invalid value and ignored.

The image associated with a ColumnHeader is typically used to indicate the state information. If you set the ImageIndex to a value greater than the index of the last item in the associated image list, ImageIndex will be set to the index of the last item in the image list.

The following code example demonstrates setting the ImageIndex, ImageKey, and DisplayIndex properties for a ColumnHeader. To run this example, paste the code into a Windows Form and call InitializeListViewColumns from the form's constructor or Load event handler.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft