ButtonBase.TextAlign 속성

정의

단추 컨트롤의 텍스트 맞춤을 가져오거나 설정합니다.

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

ContentAlignment 값 중 하나입니다. 기본값은 MiddleCenter입니다.

예외

할당된 값이 ContentAlignment 값 중 하나가 아닌 경우

예제

다음 코드 예제에서는 파생된 클래스 Button 를 사용 하 고 해당 공용 속성 중 일부를 설정 합니다. 결과는 왼쪽에 텍스트가 있고 오른쪽에 이미지가 있는 플랫 단추가 됩니다. 이 코드를 사용하려면 디렉터리에 저장된 C:\Graphics 비트 MyBitMap.bmp 맵 이미지가 있어야 하며 네임스페이스에 대한 참조 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

적용 대상

추가 정보