Aracılığıyla paylaş


ButtonBase.Image Özellik

Tanım

Düğme denetiminde görüntülenen görüntüyü alır veya ayarlar.

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, set
Public Property Image As Image

Özellik Değeri

Image Düğme denetiminde görüntülenen. Varsayılan değer null değeridir.

Örnekler

Aşağıdaki kod örneği türetilmiş sınıfını Button kullanır ve ortak özelliklerinden bazılarını ayarlar. Sonuç, solda metin bulunan düz bir düğme ve sağda bir resim olacaktır. Bu kod, dizininde C:\Graphics depolanan adlı MyBitMap.bmp bir bit eşlem görüntüye sahip olmanız ve ad alanına bir başvuru eklenmesini System.Drawing gerektirir.

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

Açıklamalar

Image Özellik ayarlandığında, ImageList özelliği olarak ayarlanır nullve ImageIndex özelliği varsayılan değeri olan -1 olarak ayarlanır.

Uyarı

FlatStyle özelliği olarak ayarlanırsaFlatStyle.System, özelliğe atanan Image görüntüler görüntülenmez.

Şunlara uygulanır

Ayrıca bkz.