다음을 통해 공유


ButtonBase.FlatStyle 속성

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

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
<LocalizableAttribute(True)> _
Public Property FlatStyle As FlatStyle
‘사용 방법
Dim instance As ButtonBase
Dim value As FlatStyle

value = instance.FlatStyle

instance.FlatStyle = value
[LocalizableAttribute(true)] 
public FlatStyle FlatStyle { get; set; }
[LocalizableAttribute(true)] 
public:
property FlatStyle FlatStyle {
    FlatStyle get ();
    void set (FlatStyle value);
}
/** @property */
public FlatStyle get_FlatStyle ()

/** @property */
public void set_FlatStyle (FlatStyle value)
public function get FlatStyle () : FlatStyle

public function set FlatStyle (value : FlatStyle)

속성 값

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

예외

예외 형식 조건

InvalidEnumArgumentException

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

설명

RadioButton 클래스 및 CheckBox 클래스의 FlatStyle 속성이 System으로 설정되면 사용자의 운영 체제에서 컨트롤을 그리므로 확인란 맞춤은 CheckAlignTextAlign 속성 값에 따라 수행됩니다. CheckAlign 속성 값은 변경되지 않지만 컨트롤의 모양은 영향을 받을 수 있습니다. 확인란은 컨트롤의 왼쪽 또는 오른쪽 가장자리에 가로로 맞춰지거나(왼쪽 또는 가운데 맞춤은 왼쪽 맞춤으로 나타내고 오른쪽 맞춤은 변경되지 않음) 설명 텍스트와 동일하게 세로로 맞춰집니다. 예를 들어, ContentAlignmentCheckAlign 속성 값을 포함하는 CheckBox 컨트롤이 있고 MiddleCenter, ContentAlignment.TopRightTextAlign 속성 값 및 FlatStyle 속성 값이 System으로 설정된 경우 텍스트 맞춤이 변경되지 않는 한 확인란 맞춤은 ContentAlignment.TopLeft로 나타납니다.

참고

FlatStyle 속성이 FlatStyle.System으로 설정되면 Image 속성에 지정된 이미지가 표시되지 않습니다.

예제

다음 코드 예제에서는 파생 클래스인 Button을 사용하고 해당 클래스의 공용 속성 중 일부를 설정합니다. 그러면 왼쪽에 텍스트가 있고 오른쪽에 이미지가 있는 평면 모양 단추가 결과로 생성됩니다. 이 코드를 실행하려면 C:\Graphics 디렉터리에 저장된 MyBitMap.bmp라는 비트맵 이미지를 사용해야 하며 System.Drawing 네임스페이스에 대한 참조가 포함되어 있어야 합니다.

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
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 void SetMyButtonProperties()
{
    // Assign an image to the button.
    button1.set_Image(Image.FromFile("C:\\Graphics\\MyBitmap.bmp"));

    // Align the image and text on the button.
    button1.set_ImageAlign(ContentAlignment.MiddleRight);
    button1.set_TextAlign(ContentAlignment.MiddleLeft);

    // Give the button a flat appearance.
    button1.set_FlatStyle(FlatStyle.Flat);
} //SetMyButtonProperties
private function 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;
 }
 

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

ButtonBase 클래스
ButtonBase 멤버
System.Windows.Forms 네임스페이스
System.Drawing.ContentAlignment