TextBoxBase.AcceptsTab プロパティ

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

Public Property AcceptsTab As Boolean
[C#]
public bool AcceptsTab {get; set;}
[C++]
public: __property bool get_AcceptsTab();public: __property void set_AcceptsTab(bool);
[JScript]
public function get AcceptsTab() : Boolean;public function set AcceptsTab(Boolean);

プロパティ値

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

解説

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

使用例

[Visual Basic, C#, C++] 派生クラス TextBox を使用して、垂直スクロール バーのある複数行 TextBox コントロールを作成する例を次に示します。この例では、 AcceptsTabAcceptsReturnWordWrap の各プロパティも使用して、テキスト ドキュメントを作成しやすいように複数行テキスト ボックス コントロールを設定します。

 
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!"
End Sub


[C#] 
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!";
 }
 

[C++] 
public:
    void CreateMyMultilineTextBox() {
        // Create an instance of a TextBox control.
        TextBox __gc *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 = S"Welcome!";
    };

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

TextBoxBase クラス | TextBoxBase メンバ | System.Windows.Forms 名前空間 | AcceptsReturn