TextBoxBase.Multiline Eigenschap

Definitie

Hiermee wordt een waarde opgehaald of ingesteld die aangeeft of dit een besturingselement voor meerdere regels is.

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

Waarde van eigenschap

true als het besturingselement een besturingselement met meerdere regels is; anders, false. De standaardwaarde is false.

Voorbeelden

In het volgende codevoorbeeld wordt een afgeleide klasse gebruikt TextBoxom een besturingselement met meerdere regels TextBox te maken met verticale schuifbalken. In dit voorbeeld worden ook de AcceptsTabeigenschappen en AcceptsReturnWordWrapeigenschappen gebruikt om het besturingselement voor meerdere regels handig te maken voor het maken van tekstdocumenten.

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

Opmerkingen

Met een tekstvak met meerdere regels kunt u meer dan één regel tekst in het besturingselement weergeven. Als de WordWrap eigenschap is ingesteld op true, wordt de tekst die in het tekstvak met meerdere regels is ingevoerd, teruggewikkeld naar de volgende regel in het besturingselement. Als de WordWrap eigenschap is ingesteld falseop, wordt tekst die is ingevoerd in het besturingselement voor meerdere regels, weergegeven op dezelfde regel totdat een nieuw regelteken is ingevoerd.

Het volgende kan worden gebruikt als nieuwe regeltekens:

U kunt schuifbalken toevoegen aan een tekstvak met behulp van de ScrollBars eigenschap om horizontale en/of verticale schuifbalken weer te geven. Hierdoor kan de gebruiker door de tekst schuiven die verder gaat dan de afmetingen van het besturingselement.

Note

Omdat de standaardwaarde van de Multiline eigenschap is false, is de standaardgrootte van een TextBox eigenschap in overeenstemming met de tekengrootte, zelfs als u het formaat van de TextBoxeigenschap wijzigt. Als u een consistente grootte voor uw TextBoxwilt krijgen, stelt u de eigenschap in Multiline op true.

Note

Als de eigenschap is ingesteld Multilineop Japanse besturingssystemen, wordt door true het instellen van de PasswordChar eigenschap de tekst van het wachtwoord weergegeven, waardoor de systeembeveiliging in gevaar komt. Stel op Japanse besturingssystemen de Multiline eigenschap false daarom in op als u de PasswordChar eigenschap instelt.

Note

Deze eigenschap is standaard ingesteld false op alle afgeleide klassen, met uitzondering van het RichTextBox besturingselement.

Voor een RichTextBox besturingselement is de RichTextBox.Multiline eigenschap van invloed op het automatisch wijzigen van de grootte van het besturingselement, als volgt:

Van toepassing op

Zie ook