TextBox.Multiline Vlastnost

Definice

Získá nebo nastaví hodnotu určující, zda se jedná o víceřádkový TextBox ovládací prvek.

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

Hodnota vlastnosti

Boolean

truepokud je ovládací prvek víceřádkovýTextBox, jinak . false Výchozí formát je false.

Příklady

Následující příklad kódu vytvoří víceřádkový TextBox ovládací prvek se svislými posuvníky. V tomto příkladu AcceptsTabse používá ovládací prvek víceřádkového textového pole a AcceptsReturnWordWrap vlastnosti, které jsou užitečné pro vytváření textových dokumentů.

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

Poznámky

AutoCompleteSource nefunguje na víceřádkových ovládacích prvcích TextBox .

Když se písmo změní, nezobrazí se žádné odsazení, které jste definovali. Pokud chcete získat odsazení, nastavte Multiline na true WM_SETFONT a přepište WM_SETFONT bez volání základní třídy tak, aby SETMARGINS nebylo volána.

Platí pro