ToolStripItem.ImageIndex 屬性

定義

取得或設定此項目上顯示的影像索引值。Gets or sets the index value of the image that is displayed on the item.

public:
 property int ImageIndex { int get(); void set(int value); };
[System.ComponentModel.Browsable(false)]
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.NoneExcludedImageIndexConverter))]
[System.Windows.Forms.RelatedImageList("Owner.ImageList")]
public int ImageIndex { get; set; }
member this.ImageIndex : int with get, set
Public Property ImageIndex As Integer

屬性值

ImageList 中為項目顯示之影像的以零起始的索引。The zero-based index of the image in the ImageList that is displayed for the item. 預設值為 -1,表示影像清單是空的。The default is -1, signifying that the image list is empty.

屬性

例外狀況

指定的值小於 -1。The value specified is less than -1.

備註

ImageIndex 屬性會指定影像在影像清單中的位置。The ImageIndex property specifies the position of the image in the image list. ImageKey 屬性會指定映射本身。The ImageKey property specifies the image itself.

[Image]、[ImageAlign]、[ImageIndex]、[ImageKey] 和 [ImageScaling] 屬性都與影像處理的各個層面有關。The Image, ImageAlign, ImageIndex, ImageKey, and ImageScaling properties pertain to various aspects of image handling. 直接設定這些屬性,或設定僅限執行時間的 ImageList 屬性,即可使用 ToolStrip 控制項中的影像。Use images in ToolStrip controls by setting these properties directly or by setting the run-time-only ImageList property.

影像調整是由 ToolStripToolStripItem中的屬性互動所決定,如下所示:Image scaling is determined by the interaction of properties in both ToolStrip and ToolStripItem, as follows:

適用於