Nyelv

TextBoxBase.AcceptsTab Tulajdonság

Definíció

Beolvas vagy beállít egy értéket, amely jelzi, hogy a TAB billentyű többsoros szövegdoboz-vezérlőben való lenyomása tabulátor karaktert ír-e be a vezérlőelembe ahelyett, hogy a fókuszt a tabulátorsor következő vezérlőelemére helyezi.

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

Tulajdonság értéke

true ha a felhasználók tabulátorokat írhatnak be egy többsoros szövegmezőbe a TAB billentyűvel; false ha a TAB billentyű lenyomásával áthelyezi a fókuszt. Az alapértelmezett érték a false.

Példák

Az alábbi példakód TextBoxegy származtatott osztály használatával hoz létre egy többsoros TextBox vezérlőt függőleges görgetősávokkal. Ez a példa a AcceptsTab, AcceptsReturnés WordWrap a tulajdonságok használatával is hasznossá teszi a többsoros szövegdoboz-vezérlőt a szövegdokumentumok létrehozásához.

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

Megjegyzések

A Multiline tulajdonságnak true tabulátor karaktert is be kell szereznie a vezérlőbe.

Ha a AcceptsTab tulajdonság be van állítva true, a felhasználónak a CTRL+TAB billentyűkombinációt lenyomva kell áthelyeznie a fókuszt a következő vezérlőelemre a tabulátor sorrendjében.

A következőre érvényes:

Lásd még