ConsoleKey ConsoleKey ConsoleKey ConsoleKey Enum

Definition

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

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

Fields

A A A A 65

A-TASTE The A key.

Add Add Add Add 107

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

Applications Applications Applications Applications 93

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

Attention Attention Attention Attention 246

ATTN-TASTE The ATTN key.

B B B B 66

B-TASTE The B key.

Backspace Backspace Backspace Backspace 8

RÜCKTASTE The BACKSPACE key.

BrowserBack BrowserBack BrowserBack BrowserBack 166

BROWSER-ZURÜCK-TASTE (Windows 2000 oder höher) The Browser Back key (Windows 2000 or later).

BrowserFavorites BrowserFavorites BrowserFavorites BrowserFavorites 171

BROWSER-FAVORITEN-TASTE (Windows 2000 oder höher) The Browser Favorites key (Windows 2000 or later).

BrowserForward BrowserForward BrowserForward BrowserForward 167

BROWSER-VORWÄRTS-TASTE (Windows 2000 oder höher) The Browser Forward key (Windows 2000 or later).

BrowserHome BrowserHome BrowserHome BrowserHome 172

BROWSER-STARTSEITE-TASTE (Windows 2000 oder höher) The Browser Home key (Windows 2000 or later).

BrowserRefresh BrowserRefresh BrowserRefresh BrowserRefresh 168

BROWSER-AKTUALISIEREN-TASTE (Windows 2000 oder höher) The Browser Refresh key (Windows 2000 or later).

BrowserSearch BrowserSearch BrowserSearch BrowserSearch 170

BROWSER-SUCHEN-TASTE (Windows 2000 oder höher) The Browser Search key (Windows 2000 or later).

BrowserStop BrowserStop BrowserStop BrowserStop 169

BROWSER-ABBRECHEN-TASTE (Windows 2000 oder höher) The Browser Stop key (Windows 2000 or later).

C C C C 67

C-TASTE The C key.

Clear Clear Clear Clear 12

ENTF-TASTE The CLEAR key.

CrSel CrSel CrSel CrSel 247

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

D D D D 68

D-TASTE The D key.

D0 D0 D0 D0 48

0-TASTE The 0 key.

D1 D1 D1 D1 49

1-TASTE The 1 key.

D2 D2 D2 D2 50

2-TASTE The 2 key.

D3 D3 D3 D3 51

3-TASTE The 3 key.

D4 D4 D4 D4 52

4-TASTE The 4 key.

D5 D5 D5 D5 53

5-TASTE The 5 key.

D6 D6 D6 D6 54

6-TASTE The 6 key.

D7 D7 D7 D7 55

7-TASTE The 7 key.

D8 D8 D8 D8 56

8-TASTE The 8 key.

D9 D9 D9 D9 57

9-TASTE The 9 key.

Decimal Decimal Decimal Decimal 110

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

Delete Delete Delete Delete 46

ENTF-TASTE The DEL (DELETE) key.

Divide Divide Divide Divide 111

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

DownArrow DownArrow DownArrow DownArrow 40

NACH-UNTEN-TASTE The DOWN ARROW key.

E E E E 69

E-TASTE The E key.

End End End End 35

ENDE-TASTE The END key.

Enter Enter Enter Enter 13

EINGABETASTE The ENTER key.

EraseEndOfFile EraseEndOfFile EraseEndOfFile EraseEndOfFile 249

ERASE EOF-TASTE The ERASE EOF key.

Escape Escape Escape Escape 27

ESC-TASTE The ESC (ESCAPE) key.

Execute Execute Execute Execute 43

AUSFÜHREN-TASTE The EXECUTE key.

ExSel ExSel ExSel ExSel 248

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

F F F F 70

F-TASTE The F key.

F1 F1 F1 F1 112

F1-TASTE The F1 key.

F10 F10 F10 F10 121

F10-TASTE The F10 key.

F11 F11 F11 F11 122

F11-TASTE The F11 key.

F12 F12 F12 F12 123

F12-TASTE The F12 key.

F13 F13 F13 F13 124

F13-TASTE The F13 key.

F14 F14 F14 F14 125

F14-TASTE The F14 key.

F15 F15 F15 F15 126

F15-TASTE The F15 key.

F16 F16 F16 F16 127

F16-TASTE The F16 key.

F17 F17 F17 F17 128

F17-TASTE The F17 key.

F18 F18 F18 F18 129

F18-TASTE The F18 key.

F19 F19 F19 F19 130

F19-TASTE The F19 key.

F2 F2 F2 F2 113

F2-TASTE The F2 key.

F20 F20 F20 F20 131

F20-TASTE The F20 key.

F21 F21 F21 F21 132

F21-TASTE The F21 key.

F22 F22 F22 F22 133

F22-TASTE The F22 key.

F23 F23 F23 F23 134

F23-TASTE The F23 key.

F24 F24 F24 F24 135

F24-TASTE The F24 key.

F3 F3 F3 F3 114

F3-TASTE The F3 key.

F4 F4 F4 F4 115

F4-TASTE The F4 key.

F5 F5 F5 F5 116

F5-TASTE The F5 key.

F6 F6 F6 F6 117

F6-TASTE The F6 key.

F7 F7 F7 F7 118

F7-TASTE The F7 key.

F8 F8 F8 F8 119

F8-TASTE The F8 key.

F9 F9 F9 F9 120

F9-TASTE The F9 key.

G G G G 71

G-TASTE The G key.

H H H H 72

H-TASTE The H key.

Help Help Help Help 47

HILFE-TASTE The HELP key.

Home Home Home Home 36

POS1-TASTE The HOME key.

I I I I 73

I-TASTE The I key.

Insert Insert Insert Insert 45

EINFG-TASTE The INS (INSERT) key.

J J J J 74

J-TASTE The J key.

K K K K 75

K-TASTE The K key.

L L L L 76

L-TASTE The L key.

LaunchApp1 LaunchApp1 LaunchApp1 LaunchApp1 182

ANWENDUNGSSTARTTASTE 1 (Microsoft Natural Keyboard, Windows 2000 oder höher) The Start Application 1 key (Microsoft Natural Keyboard, Windows 2000 or later).

LaunchApp2 LaunchApp2 LaunchApp2 LaunchApp2 183

ANWENDUNGSSTARTTASTE 2 (Microsoft Natural Keyboard, Windows 2000 oder höher) The Start Application 2 key (Microsoft Natural Keyboard, Windows 2000 or later).

LaunchMail LaunchMail LaunchMail LaunchMail 180

Taste zum Starten einer E-Mail (Microsoft Natural Keyboard, Windows 2000 oder höher) The Start Mail key (Microsoft Natural Keyboard, Windows 2000 or later).

LaunchMediaSelect LaunchMediaSelect LaunchMediaSelect LaunchMediaSelect 181

Taste für die Medienauswahl (Microsoft Natural Keyboard, Windows 2000 oder höher) The Select Media key (Microsoft Natural Keyboard, Windows 2000 or later).

LeftArrow LeftArrow LeftArrow LeftArrow 37

NACH-LINKS-TASTE The LEFT ARROW key.

LeftWindows LeftWindows LeftWindows LeftWindows 91

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

M M M M 77

M-TASTE The M key.

MediaNext MediaNext MediaNext MediaNext 176

Playertaste für den nächsten Titel (Windows 2000 oder höher) The Media Next Track key (Windows 2000 or later).

MediaPlay MediaPlay MediaPlay MediaPlay 179

Playertaste für Wiedergabe und Pause (Windows 2000 oder höher) The Media Play/Pause key (Windows 2000 or later).

MediaPrevious MediaPrevious MediaPrevious MediaPrevious 177

Playertaste für den vorherigen Titel (Windows 2000 oder höher) The Media Previous Track key (Windows 2000 or later).

MediaStop MediaStop MediaStop MediaStop 178

Playertaste für Beenden der Wiedergabe (Windows 2000 oder höher) The Media Stop key (Windows 2000 or later).

Multiply Multiply Multiply Multiply 106

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

N N N N 78

N-TASTE The N key.

NoName NoName NoName NoName 252

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

NumPad0 NumPad0 NumPad0 NumPad0 96

0-TASTE auf der Zehnertastatur The 0 key on the numeric keypad.

NumPad1 NumPad1 NumPad1 NumPad1 97

1-TASTE auf der Zehnertastatur The 1 key on the numeric keypad.

NumPad2 NumPad2 NumPad2 NumPad2 98

2-TASTE auf der Zehnertastatur The 2 key on the numeric keypad.

NumPad3 NumPad3 NumPad3 NumPad3 99

3-TASTE auf der Zehnertastatur The 3 key on the numeric keypad.

NumPad4 NumPad4 NumPad4 NumPad4 100

4-TASTE auf der Zehnertastatur The 4 key on the numeric keypad.

NumPad5 NumPad5 NumPad5 NumPad5 101

5-TASTE auf der Zehnertastatur The 5 key on the numeric keypad.

NumPad6 NumPad6 NumPad6 NumPad6 102

6-TASTE auf der Zehnertastatur The 6 key on the numeric keypad.

NumPad7 NumPad7 NumPad7 NumPad7 103

7-TASTE auf der Zehnertastatur The 7 key on the numeric keypad.

NumPad8 NumPad8 NumPad8 NumPad8 104

8-TASTE auf der Zehnertastatur The 8 key on the numeric keypad.

NumPad9 NumPad9 NumPad9 NumPad9 105

9-TASTE auf der Zehnertastatur The 9 key on the numeric keypad.

O O O O 79

O-TASTE The O key.

Oem1 Oem1 Oem1 Oem1 186

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

Oem102 Oem102 Oem102 Oem102 226

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

Oem2 Oem2 Oem2 Oem2 191

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

Oem3 Oem3 Oem3 Oem3 192

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

Oem4 Oem4 Oem4 Oem4 219

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

Oem5 Oem5 Oem5 Oem5 220

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

Oem6 Oem6 Oem6 Oem6 221

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

Oem7 Oem7 Oem7 Oem7 222

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

Oem8 Oem8 Oem8 Oem8 223

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

OemClear OemClear OemClear OemClear 254

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

OemComma OemComma OemComma OemComma 188

OEM-abhängige KOMMATASTE auf Tastatur für beliebiges Land/Region (Windows 2000 oder höher) The OEM Comma key on any country/region keyboard (Windows 2000 or later).

OemMinus OemMinus OemMinus OemMinus 189

OEM-abhängige MINUSTASTE auf Tastatur für beliebiges Land/Region (Windows 2000 oder höher) The OEM Minus key on any country/region keyboard (Windows 2000 or later).

OemPeriod OemPeriod OemPeriod OemPeriod 190

OEM-abhängige PUNKTTASTE auf Tastatur für beliebiges Land/Region (Windows 2000 oder höher) The OEM Period key on any country/region keyboard (Windows 2000 or later).

OemPlus OemPlus OemPlus OemPlus 187

OEM-abhängige PLUSTASTE auf Tastatur für beliebiges Land/Region (Windows 2000 oder höher) The OEM Plus key on any country/region keyboard (Windows 2000 or later).

P P P P 80

P-TASTE The P key.

Pa1 Pa1 Pa1 Pa1 253

PA1-TASTE The PA1 key.

Packet Packet Packet Packet 231

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

PageDown PageDown PageDown PageDown 34

BILD-AB-TASTE The PAGE DOWN key.

PageUp PageUp PageUp PageUp 33

BILD-AUF-TASTE The PAGE UP key.

Pause Pause Pause Pause 19

PAUSE-TASTE The PAUSE key.

Play Play Play Play 250

PLAY-TASTE The PLAY key.

Print Print Print Print 42

DRUCKEN-TASTE The PRINT key.

PrintScreen PrintScreen PrintScreen PrintScreen 44

DRUCK-TASTE The PRINT SCREEN key.

Process Process Process Process 229

Taste für IME-Verarbeitung The IME PROCESS key.

Q Q Q Q 81

Q-TASTE The Q key.

R R R R 82

R-TASTE The R key.

RightArrow RightArrow RightArrow RightArrow 39

NACH-RECHTS-TASTE The RIGHT ARROW key.

RightWindows RightWindows RightWindows RightWindows 92

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

S S S S 83

S-TASTE The S key.

Select Select Select Select 41

AUSWAHL-TASTE The SELECT key.

Separator Separator Separator Separator 108

TRENNZEICHENTASTE The Separator key.

Sleep Sleep Sleep Sleep 95

Taste für Standbymodus The Computer Sleep key.

Spacebar Spacebar Spacebar Spacebar 32

LEERTASTE The SPACEBAR key.

Subtract Subtract Subtract Subtract 109

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

T T T T 84

T-TASTE The T key.

Tab Tab Tab Tab 9

TAB-TASTE The TAB key.

U U U U 85

U-TASTE The U key.

UpArrow UpArrow UpArrow UpArrow 38

NACH-OBEN-TASTE The UP ARROW key.

V V V V 86

V-TASTE The V key.

VolumeDown VolumeDown VolumeDown VolumeDown 174

Taste zum Verringern der Lautstärke (Microsoft Natural Keyboard, Windows 2000 oder höher) The Volume Down key (Microsoft Natural Keyboard, Windows 2000 or later).

VolumeMute VolumeMute VolumeMute VolumeMute 173

Taste zum Stummschalten (Microsoft Natural Keyboard, Windows 2000 oder höher) The Volume Mute key (Microsoft Natural Keyboard, Windows 2000 or later).

VolumeUp VolumeUp VolumeUp VolumeUp 175

Taste zum Erhöhen der Lautstärke (Microsoft Natural Keyboard, Windows 2000 oder höher) The Volume Up key (Microsoft Natural Keyboard, Windows 2000 or later).

W W W W 87

W-TASTE The W key.

X X X X 88

X-TASTE The X key.

Y Y Y Y 89

Y-TASTE The Y key.

Z Z Z Z 90

Z-TASTE The Z key.

Zoom Zoom Zoom Zoom 251

ZOOM-TASTE The ZOOM key.

Examples

Im folgenden Beispiel wird die ConsoleKey Enumeration, um anzugeben, die dem Benutzer, welche Taste gedrückt wurde.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 werden in der Regel in der nformationen-Struktur, die von zurückgegeben wird das Console.ReadKey Methode, um anzugeben, welche in der Konsole-Taste 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