Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Aggiornamento: Luglio 2008
I controlli Line e Shape non dispongono di proprietà TabStop o TabIndex, ma è comunque possibile attivare la tabulazione tra di esse. Nell'esempio riportato di seguito, premendo i tasti CTRL e TAB è possibile passare da una forma all'altra. Premendo solo il tasto TAB è possibile passare da un pulsante all'altro.
Nota: |
|---|
Il computer potrebbe mostrare nomi o percorsi diversi per alcuni elementi dell'interfaccia utente di Visual Studio nelle istruzioni seguenti. L'edizione di Visual Studio in uso e le impostazioni utilizzate determinano questi elementi. Per ulteriori informazioni, vedere la classe Impostazioni di Visual Studio. |
Per attivare la tabulazione tra le forme
Trascinare tre controlli RectangleShape e due controlli Button dalla Casella degli strumenti al form.
Nell'editor di codice, aggiungere un'istruzione Imports o using all'inizio del modulo:
Imports Microsoft.VisualBasic.PowerPacksusing Microsoft.VisualBasic.PowerPacks;Nella routine evento, aggiungere il codice seguente:
Private Sub Shapes_PreviewKeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles _ RectangleShape1.PreviewKeyDown, RectangleShape2.PreviewKeyDown, _ RectangleShape3.PreviewKeyDown Dim sh As Shape ' Check for the Control and Tab keys. If e.KeyCode = Keys.Tab And e.Modifiers = Keys.Control Then ' Find the next shape in the order. sh = ShapeContainer1.GetNextShape(sender, True) ' Select the next shape. ShapeContainer1.SelectNextShape(sender, False, True) End If End Subprivate void shapes_PreviewKeyDown(Shape sender, System.Windows.Forms.PreviewKeyDownEventArgs e) { Shape sh; // Check for the Control and Tab keys. if (e.KeyCode == Keys.Tab && e.Modifiers == Keys.Control) // Find the next shape in the order. { sh = shapeContainer1.GetNextShape(sender, true); // Select the next shape. shapeContainer1.SelectNextShape(sender, false, true); } }Nella routine evento Button1_PreviewKeyDown, aggiungere il codice seguente:
Private Sub Button1_PreviewKeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) _ Handles Button1.PreviewKeyDown ' Check for the Control and Tab keys. If e.KeyCode = Keys.Tab And e.Modifiers = Keys.Control Then ' Select the first shape. RectangleShape1.Select() End If End Subprivate void button1_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e) { // Check for the Control and Tab keys. if (e.KeyCode == Keys.Tab & e.Modifiers == Keys.Control) // Select the first shape. { rectangleShape1.Select(); } }
Vedere anche
Attività
Procedura: disegnare forme con i controlli OvalShape e RectangleShape (Visual Studio)
Procedura: disegnare linee con il controllo LineShape (Visual Studio)
Concetti
Introduzione ai controlli Line e Shape (Visual Studio)
Cronologia delle modifiche
Data |
Cronologia |
Motivo |
|---|---|---|
|
Luglio 2008 |
Argomento aggiunto. |
Modifica di funzionalità in SP1. |
Nota: