ConsoleKey Enumeración

Definición

Especifica las teclas estándar de una consola.Specifies the standard keys on a console.

public enum class ConsoleKey
[System.Serializable]
public enum ConsoleKey
type ConsoleKey = 
Public Enum ConsoleKey
Herencia
ConsoleKey
Atributos

Campos

A 65

Tecla A.The A key.

Add 107

La tecla Agregar (tecla de adición en el teclado numérico).The Add key (the addition key on the numeric keypad).

Applications 93

Tecla de aplicación (Microsoft Natural Keyboard).The Application key (Microsoft Natural Keyboard).

Attention 246

Tecla ATTN.The ATTN key.

B 66

Tecla B.The B key.

Backspace 8

Tecla RETROCESO.The BACKSPACE key.

BrowserBack 166

Tecla Atrás del explorador (Windows 2000 o posterior).The Browser Back key (Windows 2000 or later).

BrowserFavorites 171

Tecla Favoritos del explorador (Windows 2000 o posterior).The Browser Favorites key (Windows 2000 or later).

BrowserForward 167

Tecla Adelante del explorador (Windows 2000 o posterior).The Browser Forward key (Windows 2000 or later).

BrowserHome 172

Tecla Inicio del explorador (Windows 2000 o posterior).The Browser Home key (Windows 2000 or later).

BrowserRefresh 168

Tecla Actualizar del explorador (Windows 2000 o posterior).The Browser Refresh key (Windows 2000 or later).

BrowserSearch 170

Tecla Búsqueda del explorador (Windows 2000 o posterior).The Browser Search key (Windows 2000 or later).

BrowserStop 169

Tecla Detener del explorador (Windows 2000 o posterior).The Browser Stop key (Windows 2000 or later).

C 67

Tecla C.The C key.

Clear 12

Tecla BORRAR.The CLEAR key.

CrSel 247

Tecla CRSEL (SELECCIONAR CURSOR).The CRSEL (CURSOR SELECT) key.

D 68

Tecla D.The D key.

D0 48

Tecla 0.The 0 key.

D1 49

Tecla 1.The 1 key.

D2 50

Tecla 2.The 2 key.

D3 51

Tecla 3.The 3 key.

D4 52

Tecla 4.The 4 key.

D5 53

Tecla 5.The 5 key.

D6 54

Tecla 6.The 6 key.

D7 55

Tecla 7.The 7 key.

D8 56

Tecla 8.The 8 key.

D9 57

Tecla 9.The 9 key.

Decimal 110

La tecla Decimal (tecla de decimales en el teclado numérico).The Decimal key (the decimal key on the numeric keypad).

Delete 46

Tecla SUPR (SUPRIMIR).The DEL (DELETE) key.

Divide 111

La tecla División (tecla de división en el teclado numérico).The Divide key (the division key on the numeric keypad).

DownArrow 40

Tecla FLECHA ABAJO.The DOWN ARROW key.

E 69

Tecla E.The E key.

End 35

Tecla FIN.The END key.

Enter 13

Tecla ENTRAR.The ENTER key.

EraseEndOfFile 249

Tecla ERASE EOF.The ERASE EOF key.

Escape 27

Tecla ESC (ESCAPE).The ESC (ESCAPE) key.

Execute 43

Tecla EJECUTAR.The EXECUTE key.

ExSel 248

Tecla EXSEL (EXTENDER SELECCIÓN).The EXSEL (EXTEND SELECTION) key.

F 70

Tecla F.The F key.

F1 112

Tecla F1.The F1 key.

F10 121

Tecla F10.The F10 key.

F11 122

Tecla F11.The F11 key.

F12 123

Tecla F12.The F12 key.

F13 124

Tecla F13.The F13 key.

F14 125

Tecla F14.The F14 key.

F15 126

Tecla F15.The F15 key.

F16 127

Tecla F16.The F16 key.

F17 128

Tecla F17.The F17 key.

F18 129

Tecla F18.The F18 key.

F19 130

Tecla F19.The F19 key.

F2 113

Tecla F2.The F2 key.

F20 131

Tecla F20.The F20 key.

F21 132

Tecla F21.The F21 key.

F22 133

Tecla F22.The F22 key.

F23 134

Tecla F23.The F23 key.

F24 135

Tecla F24.The F24 key.

F3 114

Tecla F3.The F3 key.

F4 115

Tecla F4.The F4 key.

F5 116

Tecla F5.The F5 key.

F6 117

Tecla F6.The F6 key.

F7 118

Tecla F7.The F7 key.

F8 119

Tecla F8.The F8 key.

F9 120

Tecla F9.The F9 key.

G 71

Tecla G.The G key.

H 72

Tecla H.The H key.

Help 47

Tecla AYUDA.The HELP key.

Home 36

Tecla INICIO.The HOME key.

I 73

Tecla I.The I key.

Insert 45

Tecla INS (INSERT).The INS (INSERT) key.

J 74

Tecla J.The J key.

K 75

Tecla K.The K key.

L 76

Tecla L.The L key.

LaunchApp1 182

Tecla 1 Iniciar aplicación (Microsoft Natural Keyboard, Windows 2000 o posterior).The Start Application 1 key (Microsoft Natural Keyboard, Windows 2000 or later).

LaunchApp2 183

Tecla Iniciar aplicación 2 (Microsoft Natural Keyboard, Windows 2000 o posterior).The Start Application 2 key (Microsoft Natural Keyboard, Windows 2000 or later).

LaunchMail 180

Tecla Iniciar correo (Microsoft Natural Keyboard, Windows 2000 o posterior).The Start Mail key (Microsoft Natural Keyboard, Windows 2000 or later).

LaunchMediaSelect 181

Tecla Seleccionar reproducción de multimedia (Microsoft Natural Keyboard, Windows 2000 o posterior).The Select Media key (Microsoft Natural Keyboard, Windows 2000 or later).

LeftArrow 37

Tecla FLECHA IZQUIERDA.The LEFT ARROW key.

LeftWindows 91

Tecla del logotipo de Windows izquierda (Microsoft Natural Keyboard).The left Windows logo key (Microsoft Natural Keyboard).

M 77

Tecla M.The M key.

MediaNext 176

Tecla Siguiente pista de multimedia (Windows 2000 o posterior).The Media Next Track key (Windows 2000 or later).

MediaPlay 179

Tecla Pausa de reproducción de multimedia (Windows 2000 o posterior).The Media Play/Pause key (Windows 2000 or later).

MediaPrevious 177

Tecla Pista anterior de multimedia (Windows 2000 o posterior).The Media Previous Track key (Windows 2000 or later).

MediaStop 178

Tecla Detener reproducción de multimedia (Windows 2000 o posterior).The Media Stop key (Windows 2000 or later).

Multiply 106

La tecla Multiplicación (la tecla de multiplicación en el teclado numérico).The Multiply key (the multiplication key on the numeric keypad).

N 78

Tecla N.The N key.

NoName 252

Constante reservada para un uso futuro.A constant reserved for future use.

NumPad0 96

Tecla 0 del teclado numérico.The 0 key on the numeric keypad.

NumPad1 97

Tecla 1 del teclado numérico.The 1 key on the numeric keypad.

NumPad2 98

Tecla 2 del teclado numérico.The 2 key on the numeric keypad.

NumPad3 99

Tecla 3 del teclado numérico.The 3 key on the numeric keypad.

NumPad4 100

Tecla 4 del teclado numérico.The 4 key on the numeric keypad.

NumPad5 101

Tecla 5 del teclado numérico.The 5 key on the numeric keypad.

NumPad6 102

Tecla 6 del teclado numérico.The 6 key on the numeric keypad.

NumPad7 103

Tecla 7 del teclado numérico.The 7 key on the numeric keypad.

NumPad8 104

Tecla 8 del teclado numérico.The 8 key on the numeric keypad.

NumPad9 105

Tecla 9 del teclado numérico.The 9 key on the numeric keypad.

O 79

Tecla O.The O key.

Oem1 186

Tecla 1 OEM (específica de OEM).The OEM 1 key (OEM specific).

Oem102 226

Tecla 102 de OEM (específica del OEM).The OEM 102 key (OEM specific).

Oem2 191

Tecla 2 de OEM (específica del OEM).The OEM 2 key (OEM specific).

Oem3 192

Tecla 3 de OEM (específica del OEM).The OEM 3 key (OEM specific).

Oem4 219

Tecla 4 de OEM (específica del OEM).The OEM 4 key (OEM specific).

Oem5 220

Tecla 5 OEM (específica de OEM).The OEM 5 (OEM specific).

Oem6 221

Tecla 6 de OEM (específica del OEM).The OEM 6 key (OEM specific).

Oem7 222

Tecla 7 de OEM (específica del OEM).The OEM 7 key (OEM specific).

Oem8 223

Tecla 8 de OEM (específica del OEM).The OEM 8 key (OEM specific).

OemClear 254

Tecla BORRAR (específica de OEM).The CLEAR key (OEM specific).

OemComma 188

Tecla Coma OEM en un teclado de cualquier país o región (Windows 2000 o posterior).The OEM Comma key on any country/region keyboard (Windows 2000 or later).

OemMinus 189

Tecla Menos OEM en un teclado de cualquier país o región (Windows 2000 o posterior).The OEM Minus key on any country/region keyboard (Windows 2000 or later).

OemPeriod 190

Tecla Punto OEM en un teclado de cualquier país o región (Windows 2000 o posterior).The OEM Period key on any country/region keyboard (Windows 2000 or later).

OemPlus 187

Tecla Más OEM en un teclado de cualquier país o región (Windows 2000 o posterior).The OEM Plus key on any country/region keyboard (Windows 2000 or later).

P 80

Tecla P.The P key.

Pa1 253

Tecla PA1.The PA1 key.

Packet 231

Tecla PAQUETE (se usa para pasar caracteres Unicode mediante pulsaciones de teclas).The PACKET key (used to pass Unicode characters with keystrokes).

PageDown 34

Tecla AV PÁG.The PAGE DOWN key.

PageUp 33

Tecla RE PÁG.The PAGE UP key.

Pause 19

Tecla PAUSA.The PAUSE key.

Play 250

Tecla PLAY.The PLAY key.

Print 42

Tecla IMPRIMIR.The PRINT key.

PrintScreen 44

Tecla IMPRIMIR PANTALLA.The PRINT SCREEN key.

Process 229

Tecla PROCESO IME.The IME PROCESS key.

Q 81

Tecla Q.The Q key.

R 82

Tecla R.The R key.

RightArrow 39

Tecla FLECHA DERECHA.The RIGHT ARROW key.

RightWindows 92

Tecla del logotipo de Windows derecha (Microsoft Natural Keyboard).The right Windows logo key (Microsoft Natural Keyboard).

S 83

Tecla S.The S key.

Select 41

Tecla SELECCIONAR.The SELECT key.

Separator 108

Tecla Separador.The Separator key.

Sleep 95

Tecla de suspensión del equipo.The Computer Sleep key.

Spacebar 32

Tecla BARRA ESPACIADORA.The SPACEBAR key.

Subtract 109

La tecla Resta (la tecla para restar en el teclado numérico).The Subtract key (the subtraction key on the numeric keypad).

T 84

Tecla T.The T key.

Tab 9

Tecla TAB.The TAB key.

U 85

Tecla U.The U key.

UpArrow 38

Tecla FLECHA ARRIBA.The UP ARROW key.

V 86

Tecla V.The V key.

VolumeDown 174

Tecla Bajar el volumen (Microsoft Natural Keyboard, Windows 2000 o posterior).The Volume Down key (Microsoft Natural Keyboard, Windows 2000 or later).

VolumeMute 173

Tecla Silenciar el volumen (Microsoft Natural Keyboard, Windows 2000 o posterior).The Volume Mute key (Microsoft Natural Keyboard, Windows 2000 or later).

VolumeUp 175

Tecla Subir el volumen (Microsoft Natural Keyboard, Windows 2000 o posterior).The Volume Up key (Microsoft Natural Keyboard, Windows 2000 or later).

W 87

Tecla W.The W key.

X 88

Tecla X.The X key.

Y 89

Tecla Y.The Y key.

Z 90

Tecla Z.The Z key.

Zoom 251

Tecla ZOOM.The ZOOM key.

Ejemplos

En el ejemplo siguiente se ConsoleKey usa la enumeración para indicar al usuario qué clave ha presionado el usuario.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. 

Comentarios

La ConsoleKey enumeración se utiliza normalmente en la estructura NFO, devuelta por el Console.ReadKey método para indicar qué tecla de la consola se ha presionado.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.

Se aplica a