ConsoleKey Sabit listesi

Tanım

Konsoldaki standart anahtarları belirtir.

public enum class ConsoleKey
public enum ConsoleKey
[System.Serializable]
public enum ConsoleKey
type ConsoleKey = 
[<System.Serializable>]
type ConsoleKey = 
Public Enum ConsoleKey
Devralma
ConsoleKey
Öznitelikler

Alanlar

Name Değer Description
None 0
Backspace 8

GERİ AL tuşu.

Tab 9

SEKME tuşu.

Clear 12

CLEAR tuşu.

Enter 13

ENTER anahtarı.

Pause 19

PAUSE tuşu.

Escape 27

ESC (ESCAPE) anahtarı.

Spacebar 32

ARA ÇUBUĞU anahtarı.

PageUp 33

PAGE UP tuşu.

PageDown 34

PAGE DOWN tuşu.

End 35

END tuşu.

Home 36

HOME tuşu.

LeftArrow 37

SOL OK tuşu.

UpArrow 38

YUKARI OK tuşu.

RightArrow 39

SAĞ OK tuşu.

DownArrow 40

AŞAĞI OK tuşu.

Select 41

SELECT tuşu.

Print 42

PRINT anahtarı.

Execute 43

EXECUTE anahtarı.

PrintScreen 44

PRINT SCREEN tuşu.

Insert 45

INS (INSERT) anahtarı.

Delete 46

DEL (DELETE) anahtarı.

Help 47

HELP anahtarı.

D0 48

0 anahtarı.

D1 49

1 anahtarı.

D2 50

2 anahtarı.

D3 51

3 anahtarı.

D4 52

4 anahtarı.

D5 53

5 anahtar.

D6 54

6 anahtarı.

D7 55

7 anahtarı.

D8 56

8 anahtarı.

D9 57

9 anahtarı.

A 65

A anahtarı.

B 66

B anahtarı.

C 67

C anahtarı.

D 68

D anahtarı.

E 69

E anahtarı.

F 70

F anahtarı.

G 71

G anahtarı.

H 72

H anahtarı.

I 73

I anahtarı.

J 74

J anahtarı.

K 75

K anahtarı.

L 76

L anahtarı.

M 77

M anahtarı.

N 78

N anahtarı.

O 79

O anahtarı.

P 80

P tuşu.

Q 81

Q anahtarı.

R 82

R anahtarı.

S 83

S anahtarı.

T 84

T anahtarı.

U 85

U anahtarı.

V 86

V anahtarı.

W 87

W tuşu.

X 88

X tuşu.

Y 89

Y anahtarı.

Z 90

Z tuşu.

LeftWindows 91

Sol Windows logo tuşu (Microsoft Natural Keyboard).

RightWindows 92

Doğru Windows logo tuşu (Microsoft Doğal Klavye).

Applications 93

Uygulama tuşu (Microsoft Doğal Klavye).

Sleep 95

Bilgisayar Uyku anahtarı.

NumPad0 96

Sayısal tuş takımındaki 0 tuşu.

NumPad1 97

Sayısal tuş takımındaki 1 tuşu.

NumPad2 98

Sayısal tuş takımındaki 2 tuşu.

NumPad3 99

Sayısal tuş takımındaki 3 tuşu.

NumPad4 100

Sayısal tuş takımındaki 4 tuşu.

NumPad5 101

Sayısal tuş takımındaki 5 tuşu.

NumPad6 102

Sayısal tuş takımındaki 6 tuşu.

NumPad7 103

Sayısal tuş takımındaki 7 tuşu.

NumPad8 104

Sayısal tuş takımındaki 8 tuşu.

NumPad9 105

Sayısal tuş takımındaki 9 tuşu.

Multiply 106

Çarpma tuşu (sayısal tuş takımındaki çarpma tuşu).

Add 107

Ekle tuşu (sayısal tuş takımındaki toplama tuşu).

Separator 108

Ayırıcı anahtarı.

Subtract 109

Çıkarma tuşu (sayısal tuş takımındaki çıkarma tuşu).

Decimal 110

Ondalık tuşu (sayısal tuş takımındaki ondalık anahtar).

Divide 111

Bölme tuşu (sayısal tuş takımındaki bölme tuşu).

F1 112

F1 anahtarı.

F2 113

F2 anahtarı.

F3 114

F3 anahtarı.

F4 115

F4 anahtarı.

F5 116

F5 anahtarı.

F6 117

F6 anahtarı.

F7 118

F7 anahtarı.

F8 119

F8 anahtarı.

F9 120

F9 anahtarı.

F10 121

F10 anahtarı.

F11 122

F11 anahtarı.

F12 123

F12 anahtarı.

F13 124

F13 anahtarı.

F14 125

F14 anahtarı.

F15 126

F15 anahtarı.

F16 127

F16 anahtarı.

F17 128

F17 anahtarı.

F18 129

F18 anahtarı.

F19 130

F19 anahtarı.

F20 131

F20 anahtarı.

F21 132

F21 anahtarı.

F22 133

F22 anahtarı.

F23 134

F23 anahtarı.

F24 135

F24 anahtarı.

BrowserBack 166

Tarayıcı Geri tuşu.

BrowserForward 167

Tarayıcı İletme tuşu.

BrowserRefresh 168

Tarayıcı Yenileme anahtarı.

BrowserStop 169

Tarayıcı Durdurma tuşu.

BrowserSearch 170

Tarayıcı Arama anahtarı.

BrowserFavorites 171

Tarayıcı Sık Kullanılanlar anahtarı.

BrowserHome 172

Tarayıcı Giriş anahtarı.

VolumeMute 173

Ses Düzeyi Sessiz tuşu (Microsoft Doğal Klavye).

VolumeDown 174

Sesi Alçalt tuşu (Microsoft Doğal Klavye).

VolumeUp 175

Ses Düzeyi Artırma tuşu (Microsoft Doğal Klavye).

MediaNext 176

Media Next Track tuşu.

MediaPrevious 177

Media Previous Track tuşu.

MediaStop 178

Medya Durdurma tuşu.

MediaPlay 179

Media Play/Pause tuşu.

LaunchMail 180

Posta Başlat tuşu (Microsoft Doğal Klavye).

LaunchMediaSelect 181

Medya Seç tuşu (Microsoft Doğal Klavye).

LaunchApp1 182

Uygulama 1'i Başlat tuşu (Microsoft Doğal Klavye).

LaunchApp2 183

Uygulama 2'yi Başlat tuşu (Microsoft Doğal Klavye).

Oem1 186

OEM 1 anahtarı (OEM'e özgü).

OemPlus 187

Herhangi bir ülke/bölge klavyesinde OEM Plus tuşu.

OemComma 188

Herhangi bir ülke/bölge klavyesinde OEM Virgül tuşu.

OemMinus 189

Herhangi bir ülke/bölge klavyesinde OEM Eksi tuşu.

OemPeriod 190

Herhangi bir ülke/bölge klavyesinde OEM Dönemi tuşu.

Oem2 191

OEM 2 anahtarı (OEM'e özgü).

Oem3 192

OEM 3 anahtarı (OEM'e özgü).

Oem4 219

OEM 4 anahtarı (OEM'e özgü).

Oem5 220

OEM 5 (OEM'e özgü).

Oem6 221

OEM 6 anahtarı (OEM'e özgü).

Oem7 222

OEM 7 anahtarı (OEM'e özgü).

Oem8 223

OEM 8 anahtarı (OEM'e özgü).

Oem102 226

OEM 102 anahtarı (OEM'e özgü).

Process 229

IME PROCESS anahtarı.

Packet 231

PACKET anahtarı (tuş vuruşlarıyla Unicode karakterleri geçirmek için kullanılır).

Attention 246

ATTN anahtarı.

CrSel 247

CRSEL (CURSOR SELECT) anahtarı.

ExSel 248

EXSEL (SEÇIMI GENIŞLET) anahtarı.

EraseEndOfFile 249

ERASE EOF anahtarı.

Play 250

PLAY tuşu.

Zoom 251

ZOOM tuşu.

NoName 252

Gelecekteki kullanım için ayrılmış bir sabit.

Pa1 253

PA1 anahtarı.

OemClear 254

CLEAR anahtarı (OEM'e özgü).

Örnekler

Aşağıdaki örnek, kullanıcıya kullanıcının hangi tuşa bastığını belirtmek için numaralandırmayı kullanır ConsoleKey .

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.HasFlag(ConsoleModifiers.Alt)) {
            output.Append(", together with " + ConsoleModifiers.Alt.ToString());
            modifiers = true;
         }
         if (input.Modifiers.HasFlag(ConsoleModifiers.Control))
         {
            if (modifiers) {
               output.Append(" and ");
            }
            else {
               output.Append(", together with ");
               modifiers = true;
            }
            output.Append(ConsoleModifiers.Control.ToString());
         }
         if (input.Modifiers.HasFlag(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, together with Alt, Ctrl, or Shift.
//       Press Esc to exit.
//       You pressed D.
//
//       Press a key, together with Alt, Ctrl, or Shift.
//       Press Esc to exit.
//       You pressed X, together with Shift.
//
//       Press a key, together with Alt, Ctrl, or Shift.
//       Press Esc to exit.
//       You pressed L, together with Control and Shift.
//
//       Press a key, together with Alt, Ctrl, or Shift.
//       Press Esc to exit.
//       You pressed P, together with Alt and Control and Shift.
//
//       Press a key, together with Alt, Ctrl, or Shift.
//       Press Esc to exit.
//       You pressed Escape.
open System
open System.Text

let mutable input = Unchecked.defaultof<ConsoleKeyInfo>

while input.Key <> ConsoleKey.Escape do
    printfn "Press a key, together with Alt, Ctrl, or Shift."
    printfn "Press Esc to exit."
    input <- Console.ReadKey true

    let output = StringBuilder $"You pressed {input.Key}"
    let mutable modifiers = false

    if input.Modifiers &&& ConsoleModifiers.Alt = ConsoleModifiers.Alt then
        output.Append ", together with {ConsoleModifiers.Alt}" |> ignore
        modifiers <- true

    if input.Modifiers &&& ConsoleModifiers.Control = ConsoleModifiers.Control then
        if modifiers then
            output.Append " and " |> ignore
    else
        output.Append ", together with " |> ignore
        modifiers <- true
        output.Append(string ConsoleModifiers.Control) |> ignore

    if input.Modifiers &&& ConsoleModifiers.Shift = ConsoleModifiers.Shift then
        if modifiers then
            output.Append " and " |> ignore
        else
            output.Append ", together with " |> ignore
            modifiers <- true
        output.Append(string ConsoleModifiers.Shift) |> ignore
    output.Append "." |> ignore
    
    printfn $"{output}\n"


// 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.

Açıklamalar

Numaralandırma ConsoleKey genellikle konsolunda hangi tuşa basıldığını belirtmek için yöntemi tarafından Console.ReadKey döndürülen nfo yapısında kullanılır.

Şunlara uygulanır