ButtonBase.ImageKey 屬性

定義

取得或設定影像在 ImageList 中的索引鍵存取子 (Accessor)。Gets or sets the key accessor for the image in the ImageList.

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

屬性值

String

表示影像按鍵的字串。A string representing the key of the image.

屬性

備註

ImageKey屬性指定影像清單中要在控制項上顯示的影像。The ImageKey property specifies the image from the image list to display on the control.

ImageKeyImageIndex 都是互斥的,也就是說,如果設定了一個,另一個會設定為不正確值並予以忽略。ImageKey and ImageIndex are mutually exclusive, meaning if one is set, the other is set to an invalid value and ignored. 如果您設定 ImageKey 屬性, ImageIndex 屬性會自動設定為-1。If you set the ImageKey property, the ImageIndex property is automatically set to -1. 或者,如果您設定 ImageIndex 屬性,會 ImageKey 自動將設定為空字串 ( "" ) 。Alternatively, if you set the ImageIndex property, the ImageKey is automatically set to an empty string ("").

適用於