Control.SetStyle(ControlStyles, Boolean) 메서드

정의

지정된 ControlStyles 플래그를 true 또는 false로 설정합니다.

protected:
 void SetStyle(System::Windows::Forms::ControlStyles flag, bool value);
protected void SetStyle (System.Windows.Forms.ControlStyles flag, bool value);
member this.SetStyle : System.Windows.Forms.ControlStyles * bool -> unit
Protected Sub SetStyle (flag As ControlStyles, value As Boolean)

매개 변수

flag
ControlStyles

설정할 ControlStyles 비트입니다.

value
Boolean

지정된 스타일을 컨트롤에 적용하려면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제에서는 a에서 Form 이중 버퍼링을 사용하도록 설정하고 변경 내용을 반영하도록 스타일을 업데이트합니다.

public:
   void EnableDoubleBuffering()
   {
      // Set the value of the double-buffering style bits to true.
      this->SetStyle( static_cast<ControlStyles>(ControlStyles::DoubleBuffer | ControlStyles::UserPaint | ControlStyles::AllPaintingInWmPaint), true );
      this->UpdateStyles();
   }
public void EnableDoubleBuffering()
{
   // Set the value of the double-buffering style bits to true.
   this.SetStyle(ControlStyles.DoubleBuffer | 
      ControlStyles.UserPaint | 
      ControlStyles.AllPaintingInWmPaint,
      true);
   this.UpdateStyles();
}
Public Sub EnableDoubleBuffering()
   ' Set the value of the double-buffering style bits to true.
   Me.SetStyle(ControlStyles.DoubleBuffer _
     Or ControlStyles.UserPaint _
     Or ControlStyles.AllPaintingInWmPaint, _
     True)
   Me.UpdateStyles()
End Sub

설명

컨트롤 스타일 비트 플래그는 지원되는 동작을 분류하는 데 사용됩니다. 컨트롤은 메서드를 호출 SetStyle 하고 적절한 ControlStyles 비트(또는 비트) 및 부울 값을 전달하여 비트를 설정하여 스타일을 사용하도록 설정할 수 있습니다. 지정된 ControlStyles 비트에 할당된 값을 확인하려면 메서드를 GetStyle 사용하고 멤버를 ControlStyles 전달하여 평가합니다.

주의

컨트롤 스타일 비트를 설정하면 컨트롤의 동작이 크게 변경됩니다. ControlStyles 열거형 설명서를 검토하여 메서드를 호출 SetStyle 하기 전에 컨트롤 스타일 비트를 변경하는 효과를 이해합니다.

적용 대상

추가 정보