TextBox.Multiline Właściwość

Definicja

Pobiera lub ustawia wartość wskazującą, czy jest to kontrolka wielowierszowa TextBox .

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

Wartość właściwości

Boolean

true jeśli kontrolka jest kontrolką wielowierszową TextBox ; w przeciwnym razie false. Wartość domyślna to false.

Przykłady

Poniższy przykład kodu tworzy kontrolkę wielowierszową TextBox z pionowymi paskami przewijania. W tym przykładzie AcceptsTabużyto właściwości , AcceptsReturni WordWrap , aby kontrolka wielowierszowego pola tekstowego przydała się do tworzenia dokumentów tekstowych.

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

Uwagi

AutoCompleteSource nie działa na kontrolkach wielowierszowych TextBox .

Po zmianie czcionki nie są wyświetlane żadne zdefiniowane wcięcie. Aby uzyskać wcięcie, ustaw wartość Multiline true i przesłoń WM_SETFONT bez wywoływania klasy bazowej, aby funkcja SETMARGINS nie jest wywoływana.

Dotyczy