ToolStripItem.ImageIndex ToolStripItem.ImageIndex ToolStripItem.ImageIndex ToolStripItem.ImageIndex Property

定义

获取或设置在该项上显示的图像的索引值。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和属性与图像处理的ImageScaling各个方面相关。 ImageIndex ImageKeyThe Image, ImageAlign, ImageIndex, ImageKey, and ImageScaling properties pertain to various aspects of image handling. 通过直接设置ToolStrip这些属性或通过设置运行时ImageList属性来使用控件中的图像。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:

适用于