TextBoxBase.Multiline 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
여러 줄 텍스트 상자 컨트롤인지 여부를 나타내는 값을 가져오거나 설정합니다.
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
속성 값
true컨트롤이 여러 줄 텍스트 상자 컨트롤이면 이고, 그렇지 않으면 . false 기본값은 false입니다.
예제
다음 코드 예제에서는 파생 클래스를 사용하여 TextBox세로 스크롤 막대가 있는 여러 줄 TextBox 컨트롤을 만듭니다. 또한 이 예제에서는 , AcceptsTab및 AcceptsReturn 속성을 사용하여 WordWrap텍스트 문서를 만드는 데 유용한 여러 줄 텍스트 상자 컨트롤을 만듭니다.
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하면 줄 바꿈 문자가 입력될 때까지 여러 줄 텍스트 상자 컨트롤에 입력된 텍스트가 같은 줄에 표시됩니다.
다음은 줄 바꿈 문자로 사용할 수 있습니다.
ControlChars.CrLf
vbCrLf(Visual Basic에만 해당)
속성을 사용하여 텍스트 상자에 스크롤 막대를 ScrollBars 추가하여 가로 및/또는 세로 스크롤 막대를 표시할 수 있습니다. 이렇게 하면 사용자가 컨트롤의 차원 이상으로 확장되는 텍스트를 스크롤할 수 있습니다.
메모
속성의 Multiline 기본값이기 false때문에 크기를 조정TextBox하더라도 기본 크기 TextBox 는 글꼴 크기에 따라 다릅니다. 일관된 크기를 TextBox얻으려면 해당 Multiline 속성을 true.로 설정합니다.
메모
일본어 운영 체제에서 Multiline 속성이 설정된 true경우 속성을 설정 PasswordChar 하면 암호 텍스트가 표시되므로 시스템 보안이 손상됩니다. 따라서 일본어 운영 체제에서 속성을 false 설정 하는 경우 속성을 설정 Multiline 합니다PasswordChar.
메모
이 속성은 컨트롤을 false 제외한 RichTextBox 모든 파생 클래스에 대해 기본적으로 설정됩니다.
컨트롤의 RichTextBox 경우 속성은 RichTextBox.Multiline 다음과 같이 컨트롤의 크기가 자동으로 조정되는지 여부에 영향을 줍니다.
설정되고 RichTextBox.Multiline 설정
truetrueRichTextBox 되면 RichTextBox.AutoSize 자동으로 크기가 조정되지 않습니다.설정되고 RichTextBox.Multiline 설정된
truefalseRichTextBox 경우 RichTextBox.AutoSize 자동으로 크기가 조정됩니다.