Bewerken

Delen via


ListViewItem.ImageKey Property

Definition

Gets or sets the key for the image that is displayed for the item.

public:
 property System::String ^ ImageKey { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ImageKeyConverter))]
public string ImageKey { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ImageKeyConverter))>]
member this.ImageKey : string with get, set
Public Property ImageKey As String

Property Value

The key for the image that is displayed for the ListViewItem.

Attributes

Remarks

ImageKey and ImageIndex are mutually exclusive, meaning if one is set, the other is set to an invalid value and ignored. If you set the ImageKey property, the ImageIndex property is automatically set to -1. Alternatively, if you set the ImageIndex property, the ImageKey is automatically set to an empty string ("").

Note

If you are using multiple image lists, for small and large icon view, with a ListView control, you should place small and large versions of the image at the same index location in their respective image lists. When switching between views, the index location of the image in one list is used to locate the image in the other list, regardless of the key value specified.

Applies to