다음을 통해 공유


TextBoxBase.Multiline 속성

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

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

구문

‘선언
<LocalizableAttribute(True)> _
Public Overridable Property Multiline As Boolean
‘사용 방법
Dim instance As TextBoxBase
Dim value As Boolean

value = instance.Multiline

instance.Multiline = value
[LocalizableAttribute(true)] 
public virtual bool Multiline { get; set; }
[LocalizableAttribute(true)] 
public:
virtual property bool Multiline {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_Multiline ()

/** @property */
public void set_Multiline (boolean value)
public function get Multiline () : boolean

public function set Multiline (value : boolean)

속성 값

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

설명

여러 줄을 입력할 수 있는 텍스트 상자에서는 컨트롤에 여러 줄의 텍스트를 표시할 수 있습니다. WordWrap 속성이 true로 설정된 경우 여러 줄을 입력할 수 있는 텍스트 상자에 입력된 텍스트는 컨트롤의 다음 줄로 줄 바꿈됩니다. WordWrap 속성이 false로 설정된 경우 여러 줄을 입력할 수 있는 TextBox 컨트롤에 입력되는 텍스트는 줄 바꿈 문자를 입력할 때까지 같은 줄에 표시됩니다.

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

ScrollBars 속성을 사용하여 텍스트 상자에 스크롤 막대를 추가하면 가로 또는 세로 스크롤 막대를 표시할 수 있습니다. 스크롤 막대를 사용하면 해당 컨트롤의 크기를 초과하는 텍스트를 스크롤할 수 있습니다.

참고

Multiline 속성의 기본값이 false이기 때문에 TextBox의 크기를 조정해도 TextBox의 기본 크기는 글꼴 크기와 일치합니다. TextBox에 맞는 크기를 가져오려면 Multiline 속성을 true로 설정합니다.

참고

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

참고

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

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

  • RichTextBox.AutoSizetrue로 설정되고 RichTextBox.Multilinetrue로 설정된 경우 RichTextBox의 크기는 자동으로 조정되지 않습니다.

  • RichTextBox.AutoSizetrue로 설정되고 RichTextBox.Multilinefalse로 설정된 경우 RichTextBox의 크기는 자동으로 조정됩니다.

예제

다음 코드 예제에서는 파생 클래스인 TextBox를 사용하여 세로 스크롤 막대가 있고 여러 줄을 입력할 수 있는 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 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
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:
   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.set_Multiline(true);
    // Add vertical scroll bars to the TextBox control.
    textBox1.set_ScrollBars(ScrollBars.Vertical);
    // Allow the RETURN key 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!" + Environment.get_NewLine()
        + "Second Line");
} //CreateMyMultilineTextBox

플랫폼

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

참고 항목

참조

TextBoxBase 클래스
TextBoxBase 멤버
System.Windows.Forms 네임스페이스
TextBoxBase.Lines 속성
WordWrap
TextBox.ScrollBars 속성