다음을 통해 공유


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 하나입니다. 기본값은 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

설명

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

메모

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

적용 대상

추가 정보