다음을 통해 공유


TextBoxBase.BorderStyle 속성

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

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

구문

‘선언
Public Property BorderStyle As BorderStyle
‘사용 방법
Dim instance As TextBoxBase
Dim value As BorderStyle

value = instance.BorderStyle

instance.BorderStyle = value
public BorderStyle BorderStyle { get; set; }
public:
property BorderStyle BorderStyle {
    BorderStyle get ();
    void set (BorderStyle value);
}
/** @property */
public BorderStyle get_BorderStyle ()

/** @property */
public void set_BorderStyle (BorderStyle value)
public function get BorderStyle () : BorderStyle

public function set BorderStyle (value : BorderStyle)

속성 값

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

예외

예외 형식 조건

InvalidEnumArgumentException

열거형의 올바른 값 범위에 속하지 않는 값이 속성에 할당된 경우

설명

BorderStyle 속성을 사용하면 기본적인 3차원 컨트롤뿐 아니라 테두리가 없는 평면 스타일의 컨트롤도 만들 수 있습니다.

참고

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

예제

다음 코드 예제에서는 파생 클래스인 TextBox를 사용하여 단일 테두리가 있으며 20포인트 Arial 글꼴의 텍스트를 올바르게 표시할 수 있는 텍스트 상자를 만듭니다. 또한 이 예제에서는 PreferredHeight 속성을 사용하여, 해당 컨트롤에 글꼴 및 BorderStyle이 할당된 후 컨트롤의 적절한 높이를 결정합니다.

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
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:
   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.set_Font(new Font("Arial", 20));
    // Set the BorderStyle property to FixedSingle.
    textBox1.set_BorderStyle(System.Windows.Forms.BorderStyle.FixedSingle);
    // Make the height of the control equal to the preferred height.
    textBox1.set_Height(textBox1.get_PreferredHeight());
} //CreateTextBox

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, 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에서 지원

.NET Compact Framework

2.0에서 지원

참고 항목

참조

TextBoxBase 클래스
TextBoxBase 멤버
System.Windows.Forms 네임스페이스