ButtonBase.TextAlign Özellik

Tanım

Düğme denetimindeki metnin hizalamasını alır veya ayarlar.

public:
 virtual property System::Drawing::ContentAlignment TextAlign { System::Drawing::ContentAlignment get(); void set(System::Drawing::ContentAlignment value); };
public virtual System.Drawing.ContentAlignment TextAlign { get; set; }
member this.TextAlign : System.Drawing.ContentAlignment with get, set
Public Overridable Property TextAlign As ContentAlignment

Özellik Değeri

Değerlerden ContentAlignment biri. Varsayılan değer: MiddleCenter.

Özel durumlar

Atanan değer değerlerden biri ContentAlignment değildir.

Ö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 MyBitMap.bmp depolanan adlı C:\Graphics 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

Şunlara uygulanır

Ayrıca bkz.