Control.TabStop Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Dient zum Abrufen oder Festlegen eines Werts, der angibt, ob der Benutzer mit der TAB-TASTE den Fokus auf dieses Steuerelement setzen kann.
public:
property bool TabStop { bool get(); void set(bool value); };
public bool TabStop { get; set; }
member this.TabStop : bool with get, set
Public Property TabStop As Boolean
Eigenschaftswert
truewenn der Benutzer den Fokus auf das Steuerelement mithilfe der TAB-TASTE setzen kann; andernfalls . false Der Standardwert lautet true.
Hinweis: Diese Eigenschaft wird immer für eine Instanz der Form Klasse zurückgegebentrue.
Beispiele
Im folgenden Codebeispiel wird einem Formular ein Button Formular hinzugefügt und einige seiner allgemeinen Eigenschaften festgelegt. Im Beispiel wird die Schaltfläche an der unteren rechten Ecke des Formulars verankert, sodass die relative Position beibehalten wird, während die Größe des Formulars geändert wird. Als Nächstes legt sie die BackgroundImage Schaltfläche auf dieselbe Größe fest und ändert sie auf die gleiche Größe wie die Image. Anschließend legt das Beispiel die TabStop Eigenschaft auf true und legt sie TabIndex fest. Schließlich wird ein Ereignishandler zum Behandeln des Click Ereignisses der Schaltfläche hinzugefügt. Dieses Beispiel erfordert, dass Sie einen ImageList Namen imageList1haben.
// Add a button to a form and set some of its common properties.
private:
void AddMyButton()
{
// Create a button and add it to the form.
Button^ button1 = gcnew Button;
// Anchor the button to the bottom right corner of the form
button1->Anchor = static_cast<AnchorStyles>(AnchorStyles::Bottom | AnchorStyles::Right);
// Assign a background image.
button1->BackgroundImage = imageList1->Images[ 0 ];
// Specify the layout style of the background image. Tile is the default.
button1->BackgroundImageLayout = ImageLayout::Center;
// Make the button the same size as the image.
button1->Size = button1->BackgroundImage->Size;
// Set the button's TabIndex and TabStop properties.
button1->TabIndex = 1;
button1->TabStop = true;
// Add a delegate to handle the Click event.
button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click );
// Add the button to the form.
this->Controls->Add( button1 );
}
// Add a button to a form and set some of its common properties.
private void AddMyButton()
{
// Create a button and add it to the form.
Button button1 = new Button();
// Anchor the button to the bottom right corner of the form
button1.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
// Assign a background image.
button1.BackgroundImage = imageList1.Images[0];
// Specify the layout style of the background image. Tile is the default.
button1.BackgroundImageLayout = ImageLayout.Center;
// Make the button the same size as the image.
button1.Size = button1.BackgroundImage.Size;
// Set the button's TabIndex and TabStop properties.
button1.TabIndex = 1;
button1.TabStop = true;
// Add a delegate to handle the Click event.
button1.Click += new System.EventHandler(this.button1_Click);
// Add the button to the form.
this.Controls.Add(button1);
}
' Add a button to a form and set some of its common properties.
Private Sub AddMyButton()
' Create a button and add it to the form.
Dim button1 As New Button()
' Anchor the button to the bottom right corner of the form
button1.Anchor = AnchorStyles.Bottom Or AnchorStyles.Right
' Assign a background image.
button1.BackgroundImage = imageList1.Images(0)
' Specify the layout style of the background image. Tile is the default.
button1.BackgroundImageLayout = ImageLayout.Center
' Make the button the same size as the image.
button1.Size = button1.BackgroundImage.Size
' Set the button's TabIndex and TabStop properties.
button1.TabIndex = 1
button1.TabStop = True
' Add a delegate to handle the Click event.
AddHandler button1.Click, AddressOf Me.button1_Click
' Add the button to the form.
Me.Controls.Add(button1)
End Sub
Hinweise
Wenn der Benutzer die TAB-TASTE drückt, wird der Eingabefokus auf das nächste Steuerelement in der Aktivierreihenfolge festgelegt. Steuerelemente mit dem TabStop Eigenschaftswert false sind nicht in der Auflistung von Steuerelementen in der Aktivierreihenfolge enthalten. Die Aktivierreihenfolge kann durch Festlegen des Eigenschaftswerts des Steuerelements TabIndex bearbeitet werden.