|
Il presente articolo è stato tradotto automaticamente. Passare il puntatore sulle frasi nell'articolo per visualizzare il testo originale. Ulteriori informazioni.
|
Traduzione
Originale
|
Classe KeyPressEventArgs
Spazio dei nomi: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Il tipo KeyPressEventArgs espone i seguenti membri.
| Nome | Descrizione | |
|---|---|---|
![]() | Equals(Object) | |
![]() | Finalize | |
![]() | GetHashCode | |
![]() | GetType | |
![]() | MemberwiseClone | |
![]() | ToString |
Nota |
|---|
public class myKeyPressClass { static long keyPressCount = 0 ; static long backspacePressed = 0; static long returnPressed = 0 ; static long escPressed = 0 ; private TextBox textBox1 = new TextBox(); private void myKeyCounter(object sender, KeyPressEventArgs ex) { switch(ex.KeyChar) { // Counts the backspaces. case '\b': backspacePressed = backspacePressed + 1; break ; // Counts the ENTER keys. case '\r': returnPressed = returnPressed + 1 ; break ; // Counts the ESC keys. case (char)27: escPressed = escPressed + 1 ; break ; // Counts all other keys. default: keyPressCount = keyPressCount + 1 ; break; } textBox1.Text = backspacePressed + " backspaces pressed\r\n" + escPressed + " escapes pressed\r\n" + returnPressed + " returns pressed\r\n" + keyPressCount + " other keys pressed\r\n" ; ex.Handled = true ; } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (ruoli di base del server non supportati), Windows Server 2008 R2 (ruoli di base del server supportati con SP1 o versione successiva, Itanium non supportato)
.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
