TextBoxBase.AcceptsTab プロパティ

定義

タブ オーダーに従って次のコントロールにフォーカスを移動させる代わりに、コントロールにタブ文字を入力させる複数行テキスト ボックス コントロールで Tab キーを押すかどうかを示す値を取得または設定します。

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

プロパティ値

Boolean

Tab キーを使用して複数行テキスト ボックスにタブを入力できる場合は true。Tab キーを押すとフォーカスが移動する場合は false。 既定値は、false です。

次のコード例では、派生クラスを使用 TextBoxして、垂直スクロール バーを含む複数行 TextBox コントロールを作成します。 この例では、複数行テキスト ボックス コントロールをAcceptsTabテキスト ドキュメントの作成に役立てるために、プロパティ 、およびWordWrapプロパティAcceptsReturnも使用します。

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

注釈

このプロパティは Multilinetrue コントロールで TAB 文字を取得する必要もあります。

プロパティが AcceptsTab 設定 trueされている場合、ユーザーは Ctrl キーを押しながら Tab キーを押して、タブ オーダーで次のコントロールにフォーカスを移動する必要があります。

適用対象

こちらもご覧ください