TextBoxBase.Multiline 속성

정의

이 컨트롤이 여러 줄을 입력할 수 있는 TextBox 컨트롤인지 여부를 나타내는 값을 가져오거나 설정합니다.

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

속성 값

Boolean

컨트롤이 여러 줄을 입력할 수 있는 TextBox 컨트롤이면 true이고, 그렇지 않으면 false입니다. 기본값은 false입니다.

예제

다음 코드 예제에서는 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

설명

여러 줄 텍스트 상자를 사용하면 컨트롤에 둘 이상의 텍스트 줄을 표시할 수 있습니다. 속성이 WordWrap 설정 true되면 여러 줄 텍스트 상자에 입력한 텍스트가 컨트롤의 다음 줄로 래핑됩니다. WordWrap 속성을 설정false하면 줄 바꿈 문자가 입력될 때까지 여러 줄 텍스트 상자 컨트롤에 입력한 텍스트가 같은 줄에 표시됩니다.

다음은 줄 바꿈 문자로 사용할 수 있습니다.

속성을 사용하여 텍스트 상자에 스크롤 막대를 ScrollBars 추가하여 가로 및/또는 세로 스크롤 막대를 표시할 수 있습니다. 이렇게 하면 사용자가 컨트롤의 차원 이상으로 확장되는 텍스트를 스크롤할 수 있습니다.

참고

속성의 Multiline 기본값이기 false때문에 크기를 조정TextBox하더라도 기본 크기 TextBox 는 글꼴 크기에 따라 조정됩니다. 일관된 크기를 TextBox얻으려면 해당 Multiline 속성을 .로 true설정합니다.

참고

일본어 운영 체제에서 속성이 Multiline 설정된 true경우 속성을 설정 PasswordChar 하면 암호 텍스트가 표시되므로 시스템 보안이 손상됩니다. 따라서 일본어 운영 체제에서 속성을 설정 하는 경우 속성을 false 설정 Multiline PasswordChar 합니다.

참고

이 속성은 컨트롤을 false 제외한 RichTextBox 모든 파생 클래스에 대해 기본적으로 설정됩니다.

컨트롤의 RichTextBox RichTextBox.Multiline 경우 속성은 다음과 같이 컨트롤의 크기를 자동으로 조정할지 여부에 영향을 줍니다.

적용 대상

추가 정보