TextBoxBase.WordWrap 속성

정의

필요한 경우 여러 줄을 입력할 수 있는 TextBox 컨트롤이 다음 줄의 처음 부분으로 줄 바꿈하는지 여부를 나타냅니다.

public:
 property bool WordWrap { bool get(); void set(bool value); };
public bool WordWrap { get; set; }
member this.WordWrap : bool with get, set
Public Property WordWrap As Boolean

속성 값

Boolean

여러 줄을 입력할 수 있는 TextBox 컨트롤에서 줄 바꿈되면 true이고, 컨트롤의 오른쪽 가장자리를 초과하여 입력할 때 TextBox 컨트롤이 자동으로 가로 방향으로 스크롤하면 false입니다. 기본값은 true입니다.

예제

다음 코드 예제에서는 TextBox파생 클래스인 세로 스크롤 막대를 사용하여 여러 줄 TextBox 컨트롤을 만듭니다. 또한 이 예제에서는 AcceptsTab여러 AcceptsReturnWordWrap 줄 텍스트 상자 컨트롤을 사용하여 텍스트 문서를 만드는 데 유용합니다.

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 RETURN key 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!" + Environment::NewLine + "Second Line";
   }
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 RETURN key 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!" + Environment.NewLine + "Second Line";
 }
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 RETURN key 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!" & Environment.NewLine & "Second Line"
End Sub

설명

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

참고

파생 클래스 TextBox에서 컨트롤 내의 텍스트는 속성이 설정되지 않는 한 TextAlign 이 속성의 속성 설정에 관계없이 항상 줄 바꿈됩니다 HorizontalAlignment.Left.

적용 대상