ConsoleKey Enum

Definition

Gibt die Standardtasten für eine Konsole an.Specifies the standard keys on a console.

public enum class ConsoleKey
public enum ConsoleKey
[System.Serializable]
public enum ConsoleKey
type ConsoleKey = 
Public Enum ConsoleKey
Inheritance
ConsoleKey
Attributes

Fields

A 65

A-TASTEThe A key.

Add 107

ADDITIONSTASTE (die Additionstaste auf der Zehnertastatur)The Add key (the addition key on the numeric keypad).

Applications 93

ANWENDUNGSTASTE (Microsoft Natural Keyboard)The Application key (Microsoft Natural Keyboard).

Attention 246

ATTN-TASTEThe ATTN key.

B 66

B-TASTEThe B key.

Backspace 8

RÜCKTASTEThe BACKSPACE key.

BrowserBack 166

BROWSER-ZURÜCK-TASTEThe Browser Back key.

BrowserFavorites 171

BROWSER-FAVORITEN-TASTEThe Browser Favorites key.

BrowserForward 167

BROWSER-VORWÄRTS-TASTEThe Browser Forward key.

BrowserHome 172

BROWSER-STARTSEITE-TASTEThe Browser Home key.

BrowserRefresh 168

BROWSER-AKTUALISIEREN-TASTEThe Browser Refresh key.

BrowserSearch 170

BROWSER-SUCHEN-TASTEThe Browser Search key.

BrowserStop 169

BROWSER-ABBRECHEN-TASTEThe Browser Stop key.

C 67

C-TASTEThe C key.

Clear 12

ENTF-TASTEThe CLEAR key.

CrSel 247

CRSEL-TASTE (Cursor auswählen)The CRSEL (CURSOR SELECT) key.

D 68

D-TASTEThe D key.

D0 48

0-TASTEThe 0 key.

D1 49

1-TASTEThe 1 key.

D2 50

2-TASTEThe 2 key.

D3 51

3-TASTEThe 3 key.

D4 52

4-TASTEThe 4 key.

D5 53

5-TASTEThe 5 key.

D6 54

6-TASTEThe 6 key.

D7 55

7-TASTEThe 7 key.

D8 56

8-TASTEThe 8 key.

D9 57

9-TASTEThe 9 key.

Decimal 110

KOMMATASTE (die Kommataste auf der Zehnertastatur)The Decimal key (the decimal key on the numeric keypad).

Delete 46

ENTF-TASTEThe DEL (DELETE) key.

Divide 111

DIVISIONSTASTE (die Divisionstaste auf der Zehnertastatur)The Divide key (the division key on the numeric keypad).

DownArrow 40

NACH-UNTEN-TASTEThe DOWN ARROW key.

E 69

E-TASTEThe E key.

End 35

ENDE-TASTEThe END key.

Enter 13

EINGABETASTEThe ENTER key.

EraseEndOfFile 249

ERASE EOF-TASTEThe ERASE EOF key.

Escape 27

ESC-TASTEThe ESC (ESCAPE) key.

Execute 43

AUSFÜHREN-TASTEThe EXECUTE key.

ExSel 248

EXSEL-TASTE (Auswahl erweitern)The EXSEL (EXTEND SELECTION) key.

F 70

F-TASTEThe F key.

F1 112

F1-TASTEThe F1 key.

F10 121

F10-TASTEThe F10 key.

F11 122

F11-TASTEThe F11 key.

F12 123

F12-TASTEThe F12 key.

F13 124

F13-TASTEThe F13 key.

F14 125

F14-TASTEThe F14 key.

F15 126

F15-TASTEThe F15 key.

F16 127

F16-TASTEThe F16 key.

F17 128

F17-TASTEThe F17 key.

F18 129

F18-TASTEThe F18 key.

F19 130

F19-TASTEThe F19 key.

F2 113

F2-TASTEThe F2 key.

F20 131

F20-TASTEThe F20 key.

F21 132

F21-TASTEThe F21 key.

F22 133

F22-TASTEThe F22 key.

F23 134

F23-TASTEThe F23 key.

F24 135

F24-TASTEThe F24 key.

F3 114

F3-TASTEThe F3 key.

F4 115

F4-TASTEThe F4 key.

F5 116

F5-TASTEThe F5 key.

F6 117

F6-TASTEThe F6 key.

F7 118

F7-TASTEThe F7 key.

F8 119

F8-TASTEThe F8 key.

F9 120

F9-TASTEThe F9 key.

G 71

G-TASTEThe G key.

H 72

H-TASTEThe H key.

Help 47

HILFE-TASTEThe HELP key.

Home 36

POS1-TASTEThe HOME key.

I 73

I-TASTEThe I key.

Insert 45

EINFG-TASTEThe INS (INSERT) key.

J 74

J-TASTEThe J key.

K 75

K-TASTEThe K key.

L 76

L-TASTEThe L key.

LaunchApp1 182

ANWENDUNGSSTARTTASTE 1 (Microsoft Natural Keyboard).The Start Application 1 key (Microsoft Natural Keyboard).

LaunchApp2 183

ANWENDUNGSSTARTTASTE 2 (Microsoft Natural Keyboard).The Start Application 2 key (Microsoft Natural Keyboard).

LaunchMail 180

Die Taste zum Starten einer E-Mail (Microsoft Natural Keyboard).The Start Mail key (Microsoft Natural Keyboard).

LaunchMediaSelect 181

Die Taste für die Medienauswahl (Microsoft Natural Keyboard).The Select Media key (Microsoft Natural Keyboard).

LeftArrow 37

NACH-LINKS-TASTEThe LEFT ARROW key.

LeftWindows 91

Linke Windows-Taste (Microsoft Natural Keyboard)The left Windows logo key (Microsoft Natural Keyboard).

M 77

M-TASTEThe M key.

MediaNext 176

Playertaste für den nächsten TitelThe Media Next Track key.

MediaPlay 179

Die WIEDERGABE-/PAUSE-TASTE für Medien.The Media Play/Pause key.

MediaPrevious 177

Playertaste für den vorherigen TitelThe Media Previous Track key.

MediaStop 178

Playertaste für das Beenden der WiedergabeThe Media Stop key.

Multiply 106

MULTIPLIKATIONSTASTE (die Multiplikationstaste auf der Zehnertastatur)The Multiply key (the multiplication key on the numeric keypad).

N 78

N-TASTEThe N key.

NoName 252

Für zukünftige Verwendung reservierte KonstanteA constant reserved for future use.

NumPad0 96

0-TASTE auf der ZehnertastaturThe 0 key on the numeric keypad.

NumPad1 97

1-TASTE auf der ZehnertastaturThe 1 key on the numeric keypad.

NumPad2 98

2-TASTE auf der ZehnertastaturThe 2 key on the numeric keypad.

NumPad3 99

3-TASTE auf der ZehnertastaturThe 3 key on the numeric keypad.

NumPad4 100

4-TASTE auf der ZehnertastaturThe 4 key on the numeric keypad.

NumPad5 101

5-TASTE auf der ZehnertastaturThe 5 key on the numeric keypad.

NumPad6 102

6-TASTE auf der ZehnertastaturThe 6 key on the numeric keypad.

NumPad7 103

7-TASTE auf der ZehnertastaturThe 7 key on the numeric keypad.

NumPad8 104

8-TASTE auf der ZehnertastaturThe 8 key on the numeric keypad.

NumPad9 105

9-TASTE auf der ZehnertastaturThe 9 key on the numeric keypad.

O 79

O-TASTEThe O key.

Oem1 186

OEM-abhängige 1-TASTE (OEM-spezifisch)The OEM 1 key (OEM specific).

Oem102 226

OEM-abhängige 102. TASTE (OEM-spezifisch)The OEM 102 key (OEM specific).

Oem2 191

OEM-abhängige 2-TASTE (OEM-spezifisch)The OEM 2 key (OEM specific).

Oem3 192

OEM-abhängige 3-TASTE (OEM-spezifisch)The OEM 3 key (OEM specific).

Oem4 219

OEM-abhängige 4-TASTE (OEM-spezifisch)The OEM 4 key (OEM specific).

Oem5 220

OEM-abhängige 5-TASTE (OEM-spezifisch)The OEM 5 (OEM specific).

Oem6 221

OEM-abhängige 6-TASTE (OEM-spezifisch)The OEM 6 key (OEM specific).

Oem7 222

OEM-abhängige 7-TASTE (OEM-spezifisch)The OEM 7 key (OEM specific).

Oem8 223

OEM-abhängige 8-TASTE (OEM-spezifisch)The OEM 8 key (OEM specific).

OemClear 254

ENTF-TASTE (OEM-spezifisch)The CLEAR key (OEM specific).

OemComma 188

Die OEM-abhängige KOMMATASTE auf Tastaturen beliebiger Länder/Regionen.The OEM Comma key on any country/region keyboard.

OemMinus 189

Die OEM-abhängige MINUSTASTE auf Tastaturen beliebiger Länder/Regionen.The OEM Minus key on any country/region keyboard.

OemPeriod 190

Die OEM-abhängige PUNKTTASTE auf Tastaturen beliebiger Länder/Regionen.The OEM Period key on any country/region keyboard.

OemPlus 187

Die OEM-abhängige PLUSTASTE auf Tastaturen beliebiger Länder/Regionen.The OEM Plus key on any country/region keyboard.

P 80

P-TASTEThe P key.

Pa1 253

PA1-TasteThe PA1 key.

Packet 231

PACKET-TASTE (zum Übergeben von Unicode-Zeichen mit Tastaturanschlägen)The PACKET key (used to pass Unicode characters with keystrokes).

PageDown 34

BILD-AB-TASTEThe PAGE DOWN key.

PageUp 33

BILD-AUF-TASTEThe PAGE UP key.

Pause 19

PAUSE-TASTEThe PAUSE key.

Play 250

PLAY-TASTEThe PLAY key.

Print 42

DRUCKEN-TASTEThe PRINT key.

PrintScreen 44

DRUCK-TASTEThe PRINT SCREEN key.

Process 229

Taste für IME-VerarbeitungThe IME PROCESS key.

Q 81

Q-TASTEThe Q key.

R 82

R-TASTEThe R key.

RightArrow 39

NACH-RECHTS-TASTEThe RIGHT ARROW key.

RightWindows 92

Rechte Windows-Taste (Microsoft Natural Keyboard)The right Windows logo key (Microsoft Natural Keyboard).

S 83

S-TASTEThe S key.

Select 41

AUSWAHL-TASTEThe SELECT key.

Separator 108

TRENNZEICHENTASTEThe Separator key.

Sleep 95

Taste für StandbymodusThe Computer Sleep key.

Spacebar 32

LEERTASTEThe SPACEBAR key.

Subtract 109

SUBTRAKTIONSTASTE (die Subtraktionstaste auf der Zehnertastatur)The Subtract key (the subtraction key on the numeric keypad).

T 84

T-TASTEThe T key.

Tab 9

TAB-TASTEThe TAB key.

U 85

U-TASTEThe U key.

UpArrow 38

NACH-OBEN-TASTEThe UP ARROW key.

V 86

V-TASTEThe V key.

VolumeDown 174

Die Taste zum Verringern der Lautstärke (Microsoft Natural Keyboard).The Volume Down key (Microsoft Natural Keyboard).

VolumeMute 173

Die Taste zum Stummschalten (Microsoft Natural Keyboard).The Volume Mute key (Microsoft Natural Keyboard).

VolumeUp 175

Die Taste Erhöhen der Lautstärke (Microsoft Natural Keyboard).The Volume Up key (Microsoft Natural Keyboard).

W 87

W-TASTEThe W key.

X 88

X-TASTEThe X key.

Y 89

Y-TASTEThe Y key.

Z 90

Z-TASTEThe Z key.

Zoom 251

ZOOM-TASTEThe ZOOM key.

Examples

Im folgenden Beispiel wird die ConsoleKey-Enumeration verwendet, um dem Benutzer mitzuteilen, welche Taste der Benutzer gedrückt hat.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. 

Remarks

Die ConsoleKey-Enumeration wird in der Regel in der nformationen-Struktur verwendet, die von der Console.ReadKey-Methode zurückgegeben wird, um anzugeben, welcher Schlüssel in der Konsole gedrückt wurde.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.

Applies to