TextBox.ScrollBars 속성

정의

여러 줄을 입력할 수 있는 TextBox 컨트롤에 표시되는 스크롤 막대를 가져오거나 설정합니다.

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

속성 값

ScrollBars

여러 줄을 입력할 수 있는 ScrollBars 컨트롤이 가로 스크롤 막대 또는 세로 스크롤 막대가 없는 상태로 표시되는지 여부를 나타내는 TextBox 열거형 값 중 하나입니다. 기본값은 ScrollBars.None입니다.

예외

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

예제

다음 코드 예제에서는 세로 스크롤 막대가 있는 여러 줄 TextBox 컨트롤을 만듭니다. 또한 이 예제에서는 , AcceptsReturnWordWrap 속성을 사용하여 AcceptsTab여러 줄 TextBox 컨트롤을 텍스트 문서를 만드는 데 유용합니다.

public:
   void CreateMyMultilineTextBox()
   {
      // Create an instance of a TextBox control.
      TextBox^ textBox1 = gcnew TextBox;
      
      // Set the Multiline property to true.
      textBox1->Multiline = true;
      // Add vertical scroll bars to the TextBox control.
      textBox1->ScrollBars = ScrollBars::Vertical;
      // Allow the TAB key to be entered in the TextBox control.
      textBox1->AcceptsReturn = true;
      // Allow the TAB key to be entered in the TextBox control.
      textBox1->AcceptsTab = true;
      // Set WordWrap to true to allow text to wrap to the next line.
      textBox1->WordWrap = true;
      // Set the default text of the control.
      textBox1->Text = "Welcome!";
   }
public void CreateMyMultilineTextBox()
{
    // Create an instance of a TextBox control.
    TextBox textBox1 = new TextBox();
    
    // Set the Multiline property to true.
    textBox1.Multiline = true;
    // Add vertical scroll bars to the TextBox control.
    textBox1.ScrollBars = ScrollBars.Vertical;
    // Allow the TAB key to be entered in the TextBox control.
    textBox1.AcceptsReturn = true;
    // Allow the TAB key to be entered in the TextBox control.
    textBox1.AcceptsTab = true;
    // Set WordWrap to true to allow text to wrap to the next line.
    textBox1.WordWrap = true;
    // Set the default text of the control.
    textBox1.Text = "Welcome!";
 }
Public Sub CreateMyMultilineTextBox()
    ' Create an instance of a TextBox control.
    Dim textBox1 As New TextBox()
    
    ' Set the Multiline property to true.
    textBox1.Multiline = True
    ' Add vertical scroll bars to the TextBox control.
    textBox1.ScrollBars = ScrollBars.Vertical
    ' Allow the TAB key to be entered in the TextBox control.
    textBox1.AcceptsReturn = True
    ' Allow the TAB key to be entered in the TextBox control.
    textBox1.AcceptsTab = True
    ' Set WordWrap to true to allow text to wrap to the next line.
    textBox1.WordWrap = True
    ' Set the default text of the control.
    textBox1.Text = "Welcome!"
End Sub

설명

속성 값 ScrollBars 에 관계없이 속성이 WordWrap 설정된 true경우 가로 스크롤 막대가 표시되지 않습니다.

적용 대상

추가 정보