ButtonBase.Image 属性  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置显示在按钮控件上的图像。
public:
 property System::Drawing::Image ^ Image { System::Drawing::Image ^ get(); void set(System::Drawing::Image ^ value); };public System.Drawing.Image Image { get; set; }public System.Drawing.Image? Image { get; set; }member this.Image : System.Drawing.Image with get, setPublic Property Image As Image属性值
按钮控件上显示的 Image。 默认值是 null。
示例
下面的代码示例使用派生类, Button 并设置其一些常见属性。 结果将是一个平面按钮,其中包含左侧的文本和右侧的图像。 此代码要求你具有一个名为 MyBitMap.bmp 存储在目录中的 C:\Graphics 位图图像,并且包含对命名空间的 System.Drawing 引用。
private:
   void SetMyButtonProperties()
   {
      // Assign an image to the button.
      button1->Image = Image::FromFile( "C:\\Graphics\\MyBitmap.bmp" );
      // Align the image and text on the button.
      button1->ImageAlign = ContentAlignment::MiddleRight;
      button1->TextAlign = ContentAlignment::MiddleLeft;
      // Give the button a flat appearance.
      button1->FlatStyle = FlatStyle::Flat;
   }
private void SetMyButtonProperties()
 {
    // Assign an image to the button.
    button1.Image = Image.FromFile("C:\\Graphics\\MyBitmap.bmp");
    // Align the image and text on the button.
    button1.ImageAlign = ContentAlignment.MiddleRight;    
    button1.TextAlign = ContentAlignment.MiddleLeft;
    // Give the button a flat appearance.
    button1.FlatStyle = FlatStyle.Flat;
 }
Private Sub SetMyButtonProperties()
    ' Assign an image to the button.
    button1.Image = Image.FromFile("C:\Graphics\MyBitmap.bmp")
    ' Align the image and text on the button.
    button1.ImageAlign = ContentAlignment.MiddleRight
    button1.TextAlign = ContentAlignment.MiddleLeft
    ' Give the button a flat appearance.
    button1.FlatStyle = FlatStyle.Flat
End Sub
注解
Image设置属性后,该ImageList属性将设置为 null,并将ImageIndex该属性设置为其默认值 -1。