Condividi tramite


Control.TabStop Proprietà

Definizione

Ottiene o imposta un valore che indica se l'utente può assegnare lo stato attivo a questo controllo utilizzando il tasto TAB.

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

Valore della proprietà

true se l'utente può assegnare lo stato attivo al controllo utilizzando il tasto TAB; in caso contrario, false. Il valore predefinito è true.

Nota: questa proprietà restituirà true sempre per un'istanza della Form classe .

Esempio

Nell'esempio di codice seguente viene aggiunto un oggetto Button a una maschera e vengono impostate alcune delle relative proprietà comuni. Nell'esempio il pulsante viene ancorato all'angolo inferiore destro del form in modo da mantenere la relativa posizione relativa man mano che viene ridimensionata la maschera. Imposta quindi e BackgroundImage ridimensiona il pulsante con le stesse dimensioni di Image. Nell'esempio viene quindi impostato su TabStoptrue e viene impostata la TabIndex proprietà . Infine, aggiunge un gestore eventi per gestire l'evento Click del pulsante. Questo esempio richiede che sia presente un ImageList oggetto denominato imageList1.

   // 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

Commenti

Quando l'utente preme TAB, lo stato attivo di input viene impostato sul controllo successivo nell'ordine di tabulazione. I controlli con il TabStop valore della proprietà di false non sono inclusi nell'insieme di controlli nell'ordine di tabulazioni. L'ordine di tabulazioni può essere modificato impostando il valore della proprietà del TabIndex controllo.

Si applica a

Vedi anche