Freigeben über


Control.TabStop-Eigenschaft

Ruft einen Wert ab, der angibt, ob Benutzer den Fokus mit der TAB-TASTE auf dieses Steuerelement setzen können, oder legt diesen fest.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Property TabStop As Boolean
'Usage
Dim instance As Control
Dim value As Boolean

value = instance.TabStop

instance.TabStop = value
public bool TabStop { get; set; }
public:
property bool TabStop {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_TabStop ()

/** @property */
public void set_TabStop (boolean value)
public function get TabStop () : boolean

public function set TabStop (value : boolean)

Eigenschaftenwert

true, wenn der Fokus mit der TAB-TASTE auf dieses Steuerelement festgelegt werden kann, andernfalls false. Der Standardwert ist true.

Hinweis

Diese Eigenschaft gibt immer true für eine Instanz der Form-Klasse zurück.

Hinweise

Wenn der Benutzer die TAB-TASTE drückt, wird der Fokus auf das nächste Steuerelement in der Aktivierreihenfolge gesetzt. Steuerelemente mit dem TabStop-Eigenschaftenwert false werden nicht in die Auflistung der Steuerelemente in der Aktivierreihenfolge aufgenommen. Die Aktivierreihenfolge kann durch Festlegen des TabIndex-Eigenschaftenwerts des Steuerelements verändert werden.

Beispiel

Im folgenden Codebeispiel wird einem Formular ein Button hinzugefügt, und es werden einige allgemeine Eigenschaften festgelegt. Im Beispiel wird die Schaltfläche in der rechten unteren Ecke des Formulars verankert, sodass sie auch dann ihre relative Position beibehält, wenn die Größe des Formulars geändert wird. Nach dem Festlegen des BackgroundImage wird die Größe der Schaltfläche auf die gleiche Größe wie das Image angepasst. Im Beispiel wird dann der TabStop auf true festgelegt. Außerdem wird die TabIndex-Eigenschaft festgelegt. Abschließend wird ein Ereignishandler hinzugefügt, um das Click-Ereignis der Schaltfläche zu behandeln. In diesem Beispiel muss ein ImageList mit der Bezeichnung imageList1 vorhanden sein.

' 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
// 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:
   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.set_Anchor(AnchorStyles.Bottom | AnchorStyles.Right);
    // Assign a background image.
    button1.set_BackgroundImage(imageList1.get_Images().get_Item(0));
    // Specify the layout style of the background image. Tile is the 
    // default.
    button1.set_BackgroundImageLayout(ImageLayout.Center);
    // Make the button the same size as the image.
    button1.set_Size(button1.get_BackgroundImage().get_Size());
    // Set the button's TabIndex and TabStop properties.
    button1.set_TabIndex(1);
    button1.set_TabStop(true);
    // Add a delegate to handle the Click event.
    button1.add_Click(new System.EventHandler(this.button1_Click));
    // Add the button to the form.
    this.get_Controls().Add(button1);
} //AddMyButton

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0

Siehe auch

Referenz

Control-Klasse
Control-Member
System.Windows.Forms-Namespace
Control.TabIndex-Eigenschaft