|
Il presente articolo è stato tradotto automaticamente. Passare il puntatore sulle frasi nell'articolo per visualizzare il testo originale. Ulteriori informazioni.
|
Traduzione
Originale
|
Enumerazione ConsoleKey
.NET Framework 4.5
Spazio dei nomi: System
Assembly: mscorlib (in mscorlib.dll)
| Nome membro | Descrizione | |
|---|---|---|
| Backspace | ||
| Tab | ||
| Clear | ||
| Enter | ||
| Pause | ||
| Escape | ||
| Spacebar | ||
| PageUp | ||
| PageDown | ||
| End | ||
| Home | ||
| LeftArrow | ||
| UpArrow | ||
| RightArrow | ||
| DownArrow | ||
| Select | ||
| Execute | ||
| PrintScreen | ||
| Insert | ||
| Delete | ||
| Help | ||
| D0 | ||
| D1 | ||
| D2 | ||
| D3 | ||
| D4 | ||
| D5 | ||
| D6 | ||
| D7 | ||
| D8 | ||
| D9 | ||
| A | ||
| B | ||
| C | ||
| D | ||
| E | ||
| F | ||
| G | ||
| H | ||
| I | ||
| J | ||
| K | ||
| L | ||
| M | ||
| N | ||
| O | ||
| P | ||
| Q | ||
| R | ||
| S | ||
| T | ||
| U | ||
| V | ||
| W | ||
| X | ||
| Y | ||
| Z | ||
| LeftWindows | ||
| RightWindows | ||
| Applications | ||
| Sleep | ||
| NumPad0 | ||
| NumPad1 | ||
| NumPad2 | ||
| NumPad3 | ||
| NumPad4 | ||
| NumPad5 | ||
| NumPad6 | ||
| NumPad7 | ||
| NumPad8 | ||
| NumPad9 | ||
| Multiply | ||
| Add | ||
| Separator | ||
| Subtract | ||
| Decimal | ||
| Divide | ||
| F1 | ||
| F2 | ||
| F3 | ||
| F4 | ||
| F5 | ||
| F6 | ||
| F7 | ||
| F8 | ||
| F9 | ||
| F10 | ||
| F11 | ||
| F12 | ||
| F13 | ||
| F14 | ||
| F15 | ||
| F16 | ||
| F17 | ||
| F18 | ||
| F19 | ||
| F20 | ||
| F21 | ||
| F22 | ||
| F23 | ||
| F24 | ||
| BrowserBack | ||
| BrowserForward | ||
| BrowserRefresh | ||
| BrowserStop | ||
| BrowserSearch | ||
| BrowserFavorites | ||
| BrowserHome | ||
| VolumeMute | ||
| VolumeDown | ||
| VolumeUp | ||
| MediaNext | ||
| MediaPrevious | ||
| MediaStop | ||
| MediaPlay | ||
| LaunchMail | ||
| LaunchMediaSelect | ||
| LaunchApp1 | ||
| LaunchApp2 | ||
| Oem1 | ||
| OemPlus | ||
| OemComma | ||
| OemMinus | ||
| OemPeriod | ||
| Oem2 | ||
| Oem3 | ||
| Oem4 | ||
| Oem5 | ||
| Oem6 | ||
| Oem7 | ||
| Oem8 | ||
| Oem102 | ||
| Process | ||
| Packet | ||
| Attention | ||
| CrSel | ||
| ExSel | ||
| EraseEndOfFile | ||
| Play | ||
| Zoom | ||
| NoName | ||
| Pa1 | ||
| OemClear |
using System; using System.Text; public class ConsoleKeyExample { public static void Main() { ConsoleKeyInfo input; do { Console.WriteLine("Press a key, together with Alt, Ctrl, or Shift."); Console.WriteLine("Press Esc to exit."); input = Console.ReadKey(true); StringBuilder output = new StringBuilder( String.Format("You pressed {0}", input.Key.ToString())); bool modifiers = false; if ((input.Modifiers & ConsoleModifiers.Alt) == ConsoleModifiers.Alt) { output.Append(", together with " + ConsoleModifiers.Alt.ToString()); modifiers = true; } if ((input.Modifiers & ConsoleModifiers.Control) == ConsoleModifiers.Control) { if (modifiers) { output.Append(" and "); } else { output.Append(", together with "); modifiers = true; } output.Append(ConsoleModifiers.Control.ToString()); } if ((input.Modifiers & ConsoleModifiers.Shift) == ConsoleModifiers.Shift) { if (modifiers) { output.Append(" and "); } else { output.Append(", together with "); modifiers = true; } output.Append(ConsoleModifiers.Shift.ToString()); } output.Append("."); Console.WriteLine(output.ToString()); Console.WriteLine(); } while (input.Key != ConsoleKey.Escape); } } // The output from a sample console session might appear as follows: // Press a key, along with Alt, Ctrl, or Shift. // Press Esc to exit. // You pressed D. // // Press a key, along with Alt, Ctrl, or Shift. // Press Esc to exit. // You pressed X, along with Shift. // // Press a key, along with Alt, Ctrl, or Shift. // Press Esc to exit. // You pressed L, along with Control and Shift. // // Press a key, along with Alt, Ctrl, or Shift. // Press Esc to exit. // You pressed P, along with Alt and Control and Shift. // // Press a key, along with Alt, Ctrl, or Shift. // Press Esc to exit. // You pressed Escape.
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.