ButtonBase.FlatStyle 속성

정의

단추 컨트롤의 평면 스타일 모양을 가져오거나 설정합니다.

public:
 property System::Windows::Forms::FlatStyle FlatStyle { System::Windows::Forms::FlatStyle get(); void set(System::Windows::Forms::FlatStyle value); };
public System.Windows.Forms.FlatStyle FlatStyle { get; set; }
member this.FlatStyle : System.Windows.Forms.FlatStyle with get, set
Public Property FlatStyle As FlatStyle

속성 값

FlatStyle

FlatStyle 값 중 하나입니다. 기본값은 Standard입니다.

예외

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

예제

다음 코드 예제에서는 파생된 클래스 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

설명

CheckBox 클래스의 RadioButton FlatStyle 속성을 설정System하면 컨트롤이 사용자의 운영 체제에 의해 그려지고 확인 맞춤은 및 TextAlign 속성 값을 기반으로 CheckAlign 합니다. CheckAlign 속성 값을 변경 하지는 않지만 컨트롤의 모양에 영향이 있을 수 있습니다. 확인란 (왼쪽 또는 가운데 맞춤은 왼쪽 맞춤, 오른쪽 변경 되지 않음) 컨트롤의 왼쪽 또는 오른쪽 가장자리에 가로로 맞춰집니다 및 세로로 정렬 설명이 포함 된 텍스트와 동일 합니다. 예를 들어 속성 값ContentAlignment이 .인 CheckBox 컨트롤이 있는 CheckAlign 경우 MiddleCenterTextAlign, 속성 값 ContentAlignment.TopRightFlatStyle 속성 값이 설정System되면 텍스트 맞춤이 변경되지 않은 상태로 유지되는 동안 확인란 맞춤이 표시됩니다ContentAlignment.TopLeft.

참고

속성이 FlatStyle 설정된 FlatStyle.System경우 속성에 Image 할당된 모든 이미지가 표시되지 않습니다.

적용 대상

추가 정보