다음을 통해 공유


TextBoxBase.BorderStyle 속성

정의

텍스트 상자 컨트롤의 테두리 형식을 가져오거나 설정합니다.

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

속성 값

BorderStyle 텍스트 상자 컨트롤의 테두리 형식을 나타내는 A입니다. 기본값은 Fixed3D입니다.

예외

열거형의 유효한 값 범위 내에 있지 않은 값이 속성에 할당되었습니다.

예제

다음 코드 예제에서는 파생 클래스를 사용하여 TextBox단일 테두리가 있는 20포인트 Arial을 사용하여 텍스트를 제대로 표시할 수 있는 텍스트 상자를 만듭니다. 이 예제에서는 속성을 사용 하 여 PreferredHeight 글꼴 후 컨트롤의 적절 한 높이 결정 하 고 BorderStyle 컨트롤에 할당 되었습니다.

public:
   void CreateTextBox()
   {
      // Create an instance of the TextBox control.
      TextBox^ textBox1 = gcnew TextBox;
      
      // Set the TextBox Font property to Arial 20.
      textBox1->Font = gcnew System::Drawing::Font( "Arial", 20 );
      // Set the BorderStyle property to FixedSingle.
      textBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
      // Make the height of the control equal to the preferred height.
      textBox1->Height = textBox1->PreferredHeight;
   }
public void CreateTextBox()
 {
    // Create an instance of the TextBox control.
    TextBox textBox1 = new TextBox();
 
    // Set the TextBox Font property to Arial 20.
    textBox1.Font = new Font ("Arial" , 20);
    // Set the BorderStyle property to FixedSingle.
    textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    // Make the height of the control equal to the preferred height.
    textBox1.Height = textBox1.PreferredHeight;
 }
Public Sub CreateTextBox()
    ' Create an instance of the TextBox control.
    Dim textBox1 As New TextBox()
    
    ' Set the TextBox Font property to Arial 20.
    textBox1.Font = New Font("Arial", 20)
    ' Set the BorderStyle property to FixedSingle.
    textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    ' Make the height of the control equal to the preferred height.
    textBox1.Height = textBox1.PreferredHeight
End Sub

설명

기본 3차원 컨트롤 외에도 이 속성을 사용하여 BorderStyle 테두리 없는 플랫 스타일 컨트롤을 만들 수 있습니다.

메모

파생 클래스인 RichTextBox이 스타일은 BorderStyle.FixedSingle 지원하지 않습니다. 이 스타일은 대신 스타일을 사용 BorderStyle.Fixed3D 하게 됩니다BorderStyle.

적용 대상