다음을 통해 공유


TextBox.ScrollBars 속성

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

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

구문

‘선언
<LocalizableAttribute(True)> _
Public Property ScrollBars As ScrollBars
‘사용 방법
Dim instance As TextBox
Dim value As ScrollBars

value = instance.ScrollBars

instance.ScrollBars = value
[LocalizableAttribute(true)] 
public ScrollBars ScrollBars { get; set; }
[LocalizableAttribute(true)] 
public:
property ScrollBars ScrollBars {
    ScrollBars get ();
    void set (ScrollBars value);
}
/** @property */
public ScrollBars get_ScrollBars ()

/** @property */
public void set_ScrollBars (ScrollBars value)
public function get ScrollBars () : ScrollBars

public function set ScrollBars (value : ScrollBars)

속성 값

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

예외

예외 형식 조건

InvalidEnumArgumentException

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

설명

WordWrap 속성이 true로 설정되어 있으면 ScrollBars 속성의 값과 관계없이 가로 스크롤 막대가 표시되지 않습니다.

예제

다음 코드 예제에서는 세로 스크롤 막대가 있고 여러 줄을 입력할 수 있는 TextBox 컨트롤을 만듭니다. 또한 이 예제에서는 AcceptsTab, AcceptsReturnWordWrap 속성을 사용하여 여러 줄을 입력할 수 있는 TextBox 컨트롤을 통해 텍스트 문서를 쉽게 만듭니다.

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
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:
   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.set_Multiline(true);
    // Add vertical scroll bars to the TextBox control.
    textBox1.set_ScrollBars(ScrollBars.Vertical);
    // Allow the TAB key to be entered in the TextBox control.
    textBox1.set_AcceptsReturn(true);
    // Allow the TAB key to be entered in the TextBox control.
    textBox1.set_AcceptsTab(true);
    // Set WordWrap to true to allow text to wrap to the next line.
    textBox1.set_WordWrap(true);
    // Set the default text of the control.
    textBox1.set_Text("Welcome!");
} //CreateMyMultilineTextBox

플랫폼

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, 1.0에서 지원

참고 항목

참조

TextBox 클래스
TextBox 멤버
System.Windows.Forms 네임스페이스
ScrollBars 열거형