TextBoxBase.AcceptsTab Właściwość

Definicja

Pobiera lub ustawia wartość wskazującą, czy naciśnięcie klawisza TAB w wielowierszowej kontrolce tekstowej powoduje, że znak TAB w kontrolce zamiast przenosić fokus do następnej kontrolki w kolejności tabulacji.

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

Wartość właściwości

Boolean

true jeśli użytkownicy mogą wprowadzać karty w wielowierszowym polu tekstowym przy użyciu klawisza TAB; false naciśnięcie klawisza TAB powoduje przeniesienie fokusu. Wartość domyślna to false.

Przykłady

W poniższym przykładzie kodu użyto TextBoxklasy pochodnej , aby utworzyć kontrolkę wielowierszową TextBox z pionowymi paskami przewijania. W tym przykładzie użyto AcceptsTabrównież 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 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

Uwagi

Właściwość Multiline musi również mieć true postać TAB w kontrolce.

AcceptsTab Jeśli właściwość jest ustawiona na true, użytkownik musi nacisnąć klawisze CTRL+TAB, aby przenieść fokus do następnej kontrolki w kolejności tabulacji.

Dotyczy

Zobacz też