TextBox.Multiline TextBox.Multiline TextBox.Multiline TextBox.Multiline Property

Definición

Obtiene o establece un valor que indica si es un control TextBox multilínea.Gets or sets a value indicating whether this is a multiline TextBox control.

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

Valor de propiedad

true si el control es un control TextBox multilínea; en caso contrario, false.true if the control is a multiline TextBox control; otherwise, false. De manera predeterminada, es false.The default is false.

Ejemplos

En el ejemplo de código siguiente se crea un multilínea TextBox control con las barras de desplazamiento vertical.The following code example creates a multiline TextBox control with vertical scroll bars. Este ejemplo se usa el AcceptsTab, AcceptsReturn, y WordWrap propiedades para hacer que el control de cuadro de texto multilínea sea útil para crear documentos de texto.This example uses the AcceptsTab, AcceptsReturn, and WordWrap properties to make the multiline text box control useful for creating text documents.

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

Comentarios

AutoCompleteSource no funciona en varias líneas TextBox controles.AutoCompleteSource does not work on multiline TextBox controls.

Cuando se cambia la fuente, no aparece ninguna sangría que haya definido.When the font is changed, any indentation that you have defined does not appear. Para obtener la sangría, establezca Multiline a true y reemplace WM_SETFONT sin llamar a la clase base para que no se llama a SETMARGINS.To get indentation, set Multiline to true and override WM_SETFONT without calling the base class so that SETMARGINS is not called.

Se aplica a