TextBox.AcceptsReturn 속성

정의

여러 줄을 입력할 수 있는 TextBox 컨트롤에서 Enter 키를 누르는 경우 새 텍스트 줄이 만들어지는지 또는 해당 폼의 기본 단추가 활성화되는지 여부를 나타내는 값을 가져오거나 설정합니다.

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

속성 값

Boolean

여러 줄을 입력할 수 있는 컨트롤에서 Enter 키를 누를 경우 새 텍스트 줄이 만들어지면 true이고, 해당 폼의 기본 단추가 활성화되면 false입니다. 기본값은 false입니다.

예제

다음 코드 예제에서는 세로 스크롤 막대를 사용 하는 여러 줄 TextBox 컨트롤을 만듭니다. 다음은 여러 AcceptsReturnWordWrap 줄 텍스트 상자 컨트롤을 AcceptsTab사용하여 텍스트 문서를 만드는 데 유용하게 만드는 예제입니다.

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 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.Multiline = true;
    // Add vertical scroll bars to the TextBox control.
    textBox1.ScrollBars = ScrollBars.Vertical;
    // Allow the RETURN 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 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 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

설명

이 속성의 값이 false면 사용자가 Ctrl+Enter를 눌러 여러 줄 TextBox 컨트롤에 새 줄을 만들어야 합니다. 폼에 대한 기본 단추가 없는 경우 Enter 키는 이 속성의 값에 관계없이 컨트롤에 항상 새 텍스트 줄을 만듭니다.

적용 대상