Redigeeri

Jagamisviis:


ImageList.ImageCollection.Item[] Property

Definition

Gets or sets an Image in an existing ImageList.

Overloads

Item[String]

Gets an Image with the specified key from the collection.

Item[Int32]

Gets or sets an Image at the specified index within the collection.

Item[String]

Gets an Image with the specified key from the collection.

public:
 property System::Drawing::Image ^ default[System::String ^] { System::Drawing::Image ^ get(System::String ^ key); };
public System.Drawing.Image this[string key] { get; }
public System.Drawing.Image? this[string key] { get; }
member this.Item(string) : System.Drawing.Image
Default Public ReadOnly Property Item(key As String) As Image

Parameters

key
String

The name of the image to retrieve from the collection.

Property Value

The Image with the specified key.

Remarks

The name of an image corresponds to its key in the ImageList.ImageCollection. The key comparison is not case-sensitive.

If an image with the specified key is not found, the value of the Item[] property is null.

Applies to

Item[Int32]

Gets or sets an Image at the specified index within the collection.

public:
 property System::Drawing::Image ^ default[int] { System::Drawing::Image ^ get(int index); void set(int index, System::Drawing::Image ^ value); };
[System.ComponentModel.Browsable(false)]
public System.Drawing.Image this[int index] { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.Item(int) : System.Drawing.Image with get, set
Default Public Property Item(index As Integer) As Image

Parameters

index
Int32

The index of the image to get or set.

Property Value

The image in the list specified by index.

Attributes

Exceptions

The index is less than 0 or greater than or equal to Count.

image is not a Bitmap.

The image to be assigned is null or not a Bitmap.

The image cannot be added to the list.

Remarks

The returned bitmap is a copy of the original image and should be disposed of using the Image.Dispose method.

Applies to