TextBoxBase.BorderStyle 속성

정의

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

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

TextBox 컨트롤의 테두리 형식을 나타내는 BorderStyle입니다. 기본값은 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.

적용 대상