ButtonBase.TextAlign ButtonBase.TextAlign ButtonBase.TextAlign ButtonBase.TextAlign Property

정의

단추 컨트롤의 텍스트 맞춤을 가져오거나 설정합니다.Gets or sets the alignment of the text on the button control.

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

속성 값

ContentAlignment 값 중 하나입니다.One of the ContentAlignment values. 기본값은 MiddleCenter입니다.The default is MiddleCenter.

예외

할당 된 값 중 하나가 아닙니다는 ContentAlignment 값입니다.The value assigned is not one of the ContentAlignment values.

예제

다음 코드 예제에서는 파생된 클래스인 Button 해당 공용 속성 중 일부를 설정 합니다.The following code example uses the derived class, Button and sets some of its common properties. 결과 왼쪽 및 오른쪽에 있는 이미지를 사용 하 여 플랫 단추 됩니다.The result will be a flat button with text on the left and an image on the right. 이 코드를 실행 하려면 명명 된 bitmapimage 있다고 MyBitMap.bmp 에 저장 합니다 C:\Graphics 디렉터리와는에 대 한 참조를 System.Drawing 네임 스페이스는 포함.This code requires that you have a bitmap image named MyBitMap.bmp stored in the C:\Graphics directory, and that a reference to the System.Drawing namespace is included.

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 'SetMyButtonProperties

적용 대상

추가 정보