ConsoleKey ConsoleKey ConsoleKey ConsoleKey Enum

Definizione

Specifica i tasti standard in una console.Specifies the standard keys on a console.

public enum class ConsoleKey
[System.Serializable]
public enum ConsoleKey
type ConsoleKey = 
Public Enum ConsoleKey
Ereditarietà
Attributi

Campi

A A A A 65

Tasto A.The A key.

Add Add Add Add 107

Tasto di addizione (il tasto di addizione sul tastierino numerico).The Add key (the addition key on the numeric keypad).

Applications Applications Applications Applications 93

Tasto dell'applicazione (Microsoft Natural Keyboard).The Application key (Microsoft Natural Keyboard).

Attention Attention Attention Attention 246

Tasto ATTN.The ATTN key.

B B B B 66

Tasto B.The B key.

Backspace Backspace Backspace Backspace 8

Tasto BACKSPACE.The BACKSPACE key.

BrowserBack BrowserBack BrowserBack BrowserBack 166

Rappresenta il tasto Indietro del browser, disponibile solo in Windows 2000 o versione successiva.The Browser Back key (Windows 2000 or later).

BrowserFavorites BrowserFavorites BrowserFavorites BrowserFavorites 171

Rappresenta il tasto Preferiti del browser, disponibile solo in Windows 2000 o versione successiva.The Browser Favorites key (Windows 2000 or later).

BrowserForward BrowserForward BrowserForward BrowserForward 167

Rappresenta il tasto Avanti del browser, disponibile solo in Windows 2000 o versione successiva.The Browser Forward key (Windows 2000 or later).

BrowserHome BrowserHome BrowserHome BrowserHome 172

Rappresenta il tasto Home del browser, disponibile solo in Windows 2000 o versione successiva.The Browser Home key (Windows 2000 or later).

BrowserRefresh BrowserRefresh BrowserRefresh BrowserRefresh 168

Rappresenta il tasto Aggiorna del browser, disponibile solo in Windows 2000 o versione successiva.The Browser Refresh key (Windows 2000 or later).

BrowserSearch BrowserSearch BrowserSearch BrowserSearch 170

Rappresenta il tasto Cerca del browser, disponibile solo in Windows 2000 o versione successiva.The Browser Search key (Windows 2000 or later).

BrowserStop BrowserStop BrowserStop BrowserStop 169

Rappresenta il tasto Stop del browser, disponibile solo in Windows 2000 o versione successiva.The Browser Stop key (Windows 2000 or later).

C C C C 67

Tasto C.The C key.

Clear Clear Clear Clear 12

Tasto CANCELLA.The CLEAR key.

CrSel CrSel CrSel CrSel 247

Rappresenta il tasto CRSEL (SELEZIONA CURSORE).The CRSEL (CURSOR SELECT) key.

D D D D 68

Tasto D.The D key.

D0 D0 D0 D0 48

Tasto 0.The 0 key.

D1 D1 D1 D1 49

Tasto 1.The 1 key.

D2 D2 D2 D2 50

Tasto 2.The 2 key.

D3 D3 D3 D3 51

Tasto 3.The 3 key.

D4 D4 D4 D4 52

Tasto 4.The 4 key.

D5 D5 D5 D5 53

Tasto 5.The 5 key.

D6 D6 D6 D6 54

Tasto 6.The 6 key.

D7 D7 D7 D7 55

Tasto 7.The 7 key.

D8 D8 D8 D8 56

Tasto 8.The 8 key.

D9 D9 D9 D9 57

Tasto 9.The 9 key.

Decimal Decimal Decimal Decimal 110

Tasto della virgola decimale (il tasto della virgola decimale sul tastierino numerico).The Decimal key (the decimal key on the numeric keypad).

Delete Delete Delete Delete 46

Rappresenta il tasto CANC (ANNULLA).The DEL (DELETE) key.

Divide Divide Divide Divide 111

Tasto di divisione (il tasto della divisione sul tastierino numerico).The Divide key (the division key on the numeric keypad).

DownArrow DownArrow DownArrow DownArrow 40

Tasto freccia GIÙ.The DOWN ARROW key.

E E E E 69

Tasto E.The E key.

End End End End 35

Tasto FINE.The END key.

Enter Enter Enter Enter 13

Tasto INVIO.The ENTER key.

EraseEndOfFile EraseEndOfFile EraseEndOfFile EraseEndOfFile 249

Tasto di cancellazione EOF.The ERASE EOF key.

Escape Escape Escape Escape 27

Rappresenta il tasto ESC.The ESC (ESCAPE) key.

Execute Execute Execute Execute 43

Tasto EXECUTE.The EXECUTE key.

ExSel ExSel ExSel ExSel 248

Rappresenta il tasto (ESTENDI SELEZIONE).The EXSEL (EXTEND SELECTION) key.

F F F F 70

Tasto F.The F key.

F1 F1 F1 F1 112

Tasto F1.The F1 key.

F10 F10 F10 F10 121

Tasto F10.The F10 key.

F11 F11 F11 F11 122

Tasto F11.The F11 key.

F12 F12 F12 F12 123

Tasto F12.The F12 key.

F13 F13 F13 F13 124

Tasto F13.The F13 key.

F14 F14 F14 F14 125

Tasto F14.The F14 key.

F15 F15 F15 F15 126

Tasto F15.The F15 key.

F16 F16 F16 F16 127

Tasto F16.The F16 key.

F17 F17 F17 F17 128

Tasto F17.The F17 key.

F18 F18 F18 F18 129

Tasto F18.The F18 key.

F19 F19 F19 F19 130

Tasto F19.The F19 key.

F2 F2 F2 F2 113

Tasto F2.The F2 key.

F20 F20 F20 F20 131

Tasto F20.The F20 key.

F21 F21 F21 F21 132

Tasto F21.The F21 key.

F22 F22 F22 F22 133

Tasto F22.The F22 key.

F23 F23 F23 F23 134

Tasto F23.The F23 key.

F24 F24 F24 F24 135

Tasto F24.The F24 key.

F3 F3 F3 F3 114

Tasto F3.The F3 key.

F4 F4 F4 F4 115

Tasto F4.The F4 key.

F5 F5 F5 F5 116

Tasto F5.The F5 key.

F6 F6 F6 F6 117

Tasto F6.The F6 key.

F7 F7 F7 F7 118

Tasto F7.The F7 key.

F8 F8 F8 F8 119

Tasto F8.The F8 key.

F9 F9 F9 F9 120

Tasto F9.The F9 key.

G G G G 71

Tasto G.The G key.

H H H H 72

Tasto H.The H key.

Help Help Help Help 47

Tasto HELP.The HELP key.

Home Home Home Home 36

Tasto HOME.The HOME key.

I I I I 73

Tasto I.The I key.

Insert Insert Insert Insert 45

Rappresenta il tasto INS (INSERISCI).The INS (INSERT) key.

J J J J 74

Tasto J.The J key.

K K K K 75

Tasto K.The K key.

L L L L 76

Tasto L.The L key.

LaunchApp1 LaunchApp1 LaunchApp1 LaunchApp1 182

Rappresenta il tasto di avvio menu scelta rapida uno, disponibile in Microsoft Natural Keyboard e Windows 2000 o versione successiva.The Start Application 1 key (Microsoft Natural Keyboard, Windows 2000 or later).

LaunchApp2 LaunchApp2 LaunchApp2 LaunchApp2 183

Rappresenta il tasto di avvio menu scelta rapida due, disponibile in Microsoft Natural Keyboard e Windows 2000 o versione successiva.The Start Application 2 key (Microsoft Natural Keyboard, Windows 2000 or later).

LaunchMail LaunchMail LaunchMail LaunchMail 180

Rappresenta il tasto di avvio posta, disponibile in Microsoft Natural Keyboard e Windows 2000 o versione successiva.The Start Mail key (Microsoft Natural Keyboard, Windows 2000 or later).

LaunchMediaSelect LaunchMediaSelect LaunchMediaSelect LaunchMediaSelect 181

Rappresenta il tasto TV, disponibile in Microsoft Natural Keyboard e Windows 2000 o versione successiva.The Select Media key (Microsoft Natural Keyboard, Windows 2000 or later).

LeftArrow LeftArrow LeftArrow LeftArrow 37

Tasto freccia SINISTRA.The LEFT ARROW key.

LeftWindows LeftWindows LeftWindows LeftWindows 91

Tasto WINDOWS sinistro (Microsoft Natural Keyboard).The left Windows logo key (Microsoft Natural Keyboard).

M M M M 77

Tasto M.The M key.

MediaNext MediaNext MediaNext MediaNext 176

Rappresenta il tasto BRANO SUCCESSIVO, disponibile solo in Windows 2000 o versione successiva.The Media Next Track key (Windows 2000 or later).

MediaPlay MediaPlay MediaPlay MediaPlay 179

Rappresenta il tasto di sospensione della riproduzione, disponibile solo in Windows 2000 o versione successiva.The Media Play/Pause key (Windows 2000 or later).

MediaPrevious MediaPrevious MediaPrevious MediaPrevious 177

Rappresenta il tasto BRANO PRECEDENTE, disponibile solo in Windows 2000 o versione successiva.The Media Previous Track key (Windows 2000 or later).

MediaStop MediaStop MediaStop MediaStop 178

Rappresenta il tasto di interruzione della riproduzione, disponibile solo in Windows 2000 o versione successiva.The Media Stop key (Windows 2000 or later).

Multiply Multiply Multiply Multiply 106

Tasto di moltiplicazione (il tasto della moltiplicazione sul tastierino numerico).The Multiply key (the multiplication key on the numeric keypad).

N N N N 78

Tasto N.The N key.

NoName NoName NoName NoName 252

Costante riservata per l'uso futuro.A constant reserved for future use.

NumPad0 NumPad0 NumPad0 NumPad0 96

Tasto 0 del tastierino numerico.The 0 key on the numeric keypad.

NumPad1 NumPad1 NumPad1 NumPad1 97

Tasto 1 del tastierino numerico.The 1 key on the numeric keypad.

NumPad2 NumPad2 NumPad2 NumPad2 98

Tasto 2 del tastierino numerico.The 2 key on the numeric keypad.

NumPad3 NumPad3 NumPad3 NumPad3 99

Tasto 3 del tastierino numerico.The 3 key on the numeric keypad.

NumPad4 NumPad4 NumPad4 NumPad4 100

Tasto 4 del tastierino numerico.The 4 key on the numeric keypad.

NumPad5 NumPad5 NumPad5 NumPad5 101

Tasto 5 del tastierino numerico.The 5 key on the numeric keypad.

NumPad6 NumPad6 NumPad6 NumPad6 102

Tasto 6 del tastierino numerico.The 6 key on the numeric keypad.

NumPad7 NumPad7 NumPad7 NumPad7 103

Tasto 7 del tastierino numerico.The 7 key on the numeric keypad.

NumPad8 NumPad8 NumPad8 NumPad8 104

Tasto 8 del tastierino numerico.The 8 key on the numeric keypad.

NumPad9 NumPad9 NumPad9 NumPad9 105

Tasto 9 del tastierino numerico.The 9 key on the numeric keypad.

O O O O 79

Tasto O.The O key.

Oem1 Oem1 Oem1 Oem1 186

Chiave OEM 1 (specifica OEM).The OEM 1 key (OEM specific).

Oem102 Oem102 Oem102 Oem102 226

Chiave OEM 102 (specifica OEM).The OEM 102 key (OEM specific).

Oem2 Oem2 Oem2 Oem2 191

Chiave OEM 2 (specifica OEM).The OEM 2 key (OEM specific).

Oem3 Oem3 Oem3 Oem3 192

Chiave OEM 3 (specifica OEM).The OEM 3 key (OEM specific).

Oem4 Oem4 Oem4 Oem4 219

Chiave OEM 4 (specifica OEM).The OEM 4 key (OEM specific).

Oem5 Oem5 Oem5 Oem5 220

Chiave OEM 5 (specifica OEM).The OEM 5 (OEM specific).

Oem6 Oem6 Oem6 Oem6 221

Chiave OEM 6 (specifica OEM).The OEM 6 key (OEM specific).

Oem7 Oem7 Oem7 Oem7 222

Chiave OEM 7 (specifica OEM).The OEM 7 key (OEM specific).

Oem8 Oem8 Oem8 Oem8 223

Chiave OEM 8 (specifica OEM).The OEM 8 key (OEM specific).

OemClear OemClear OemClear OemClear 254

Rappresenta il tasto CANCELLA (specifico OEM).The CLEAR key (OEM specific).

OemComma OemComma OemComma OemComma 188

Rappresenta il tasto Virgola OEM di qualsiasi tastiera, disponibile solo in Windows 2000 o versione successiva.The OEM Comma key on any country/region keyboard (Windows 2000 or later).

OemMinus OemMinus OemMinus OemMinus 189

Rappresenta il tasto Meno OEM di qualsiasi tastiera, disponibile solo in Windows 2000 o versione successiva.The OEM Minus key on any country/region keyboard (Windows 2000 or later).

OemPeriod OemPeriod OemPeriod OemPeriod 190

Rappresenta il tasto Punto OEM di qualsiasi tastiera, disponibile solo in Windows 2000 o versione successiva.The OEM Period key on any country/region keyboard (Windows 2000 or later).

OemPlus OemPlus OemPlus OemPlus 187

Rappresenta il tasto Più OEM di qualsiasi tastiera, disponibile solo in Windows 2000 o versione successiva.The OEM Plus key on any country/region keyboard (Windows 2000 or later).

P P P P 80

Tasto P.The P key.

Pa1 Pa1 Pa1 Pa1 253

Tasto PA1.The PA1 key.

Packet Packet Packet Packet 231

Chiave PACKET, utilizzata per passare i caratteri Unicode tramite la pressione dei tasti.The PACKET key (used to pass Unicode characters with keystrokes).

PageDown PageDown PageDown PageDown 34

Tasto PGGIÙ.The PAGE DOWN key.

PageUp PageUp PageUp PageUp 33

Tasto PGSU.The PAGE UP key.

Pause Pause Pause Pause 19

Tasto PAUSA.The PAUSE key.

Play Play Play Play 250

Tasto PLAY.The PLAY key.

Print Print Print Print 42

Tasto STAMPA.The PRINT key.

PrintScreen PrintScreen PrintScreen PrintScreen 44

Tasto STAMP.The PRINT SCREEN key.

Process Process Process Process 229

Rappresenta il tasto di elaborazione IME.The IME PROCESS key.

Q Q Q Q 81

Tasto Q.The Q key.

R R R R 82

Tasto R.The R key.

RightArrow RightArrow RightArrow RightArrow 39

Tasto freccia DESTRA.The RIGHT ARROW key.

RightWindows RightWindows RightWindows RightWindows 92

Tasto WINDOWS destro (Microsoft Natural Keyboard).The right Windows logo key (Microsoft Natural Keyboard).

S S S S 83

Tasto S.The S key.

Select Select Select Select 41

Tasto SELECT.The SELECT key.

Separator Separator Separator Separator 108

Tasto separatore.The Separator key.

Sleep Sleep Sleep Sleep 95

Tasto di sospensione del computer.The Computer Sleep key.

Spacebar Spacebar Spacebar Spacebar 32

Tasto BARRA SPAZIATRICE.The SPACEBAR key.

Subtract Subtract Subtract Subtract 109

Tasto di sottrazione (il tasto della sottrazione sul tastierino numerico).The Subtract key (the subtraction key on the numeric keypad).

T T T T 84

Tasto T.The T key.

Tab Tab Tab Tab 9

Tasto TAB.The TAB key.

U U U U 85

Tasto U.The U key.

UpArrow UpArrow UpArrow UpArrow 38

Tasto freccia SU.The UP ARROW key.

V V V V 86

Tasto V.The V key.

VolumeDown VolumeDown VolumeDown VolumeDown 174

Rappresenta il tasto Riduzione volume, disponibile in Microsoft Natural Keyboard e Windows 2000 o versione successiva.The Volume Down key (Microsoft Natural Keyboard, Windows 2000 or later).

VolumeMute VolumeMute VolumeMute VolumeMute 173

Rappresenta il tasto di disattivazione del volume (MUTE), disponibile in Microsoft Natural Keyboard e Windows 2000 o versione successiva.The Volume Mute key (Microsoft Natural Keyboard, Windows 2000 or later).

VolumeUp VolumeUp VolumeUp VolumeUp 175

Rappresenta il tasto Aumento volume, disponibile in Microsoft Natural Keyboard e Windows 2000 o versione successiva.The Volume Up key (Microsoft Natural Keyboard, Windows 2000 or later).

W W W W 87

Tasto W.The W key.

X X X X 88

Tasto X.The X key.

Y Y Y Y 89

Tasto Y.The Y key.

Z Z Z Z 90

Tasto Z.The Z key.

Zoom Zoom Zoom Zoom 251

Tasto ZOOM.The ZOOM key.

Esempi

Nell'esempio seguente viene usata ConsoleKey l'enumerazione per indicare all'utente la chiave che l'utente ha premuto.The following example uses the ConsoleKey enumeration to indicate to the user which key the user had pressed.

using namespace System;
using namespace System::Text;

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 = gcnew 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. 
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. 
Imports System.Text

Module ConsoleKeyExample

   Public Sub Main()
      Dim input As ConsoleKeyInfo
      Do 
         Console.WriteLine("Press a key, together with Alt, Ctrl, or Shift.")
         Console.WriteLine("Press Esc to exit.")
         input = Console.ReadKey(True)

         Dim output As New StringBuilder(String.Format("You pressed {0}", input.Key.ToString()))
         Dim modifiers As Boolean

         If (input.Modifiers And ConsoleModifiers.Alt) = ConsoleModifiers.Alt Then
            output.Append(", together with " + ConsoleModifiers.Alt.ToString())
            modifiers = True
         End If
         If (input.Modifiers And ConsoleModifiers.Control) = ConsoleModifiers.Control Then
            If modifiers Then
               output.Append(" and ")
            Else
               output.Append(", together with ")
               modifiers = True
            End If
            output.Append(ConsoleModifiers.Control.ToString)
         End If
         If (input.Modifiers And ConsoleModifiers.Shift) = ConsoleModifiers.Shift Then
            If modifiers Then
               output.Append(" and ")
            Else
               output.Append(", together with ")
            End If
            output.Append(ConsoleModifiers.Shift.ToString)
         End If
         output.Append(".")                  
         Console.WriteLine(output.ToString())
         Console.WriteLine()
      Loop While input.Key <> ConsoleKey.Escape        
   End Sub
End Module
' 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. 

Commenti

L' ConsoleKey enumerazione viene in genere usata nella struttura NFO, che viene restituita Console.ReadKey dal metodo per indicare quale tasto sulla console è stato premuto.The ConsoleKey enumeration is typically used in the nfo structure, which is returned by the Console.ReadKey method to indicate which key on the console has been pressed.

Si applica a