Keys Sabit listesi

Tanım

Anahtar kodlarını ve değiştiricileri belirtir.

Bu sabit listesi, üyeleri için bit düzeyinde karşılaştırmayı destekler.

public enum class Keys
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.KeysConverter))]
[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
public enum Keys
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.KeysConverter))]
[System.Flags]
public enum Keys
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.KeysConverter))>]
[<System.Flags>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Keys = 
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.KeysConverter))>]
[<System.Flags>]
type Keys = 
Public Enum Keys
Devralma
Öznitelikler

Alanlar

Name Değer Description
Modifiers -65536

Anahtar değerinden değiştiricileri ayıklamak için bit maskesi.

None 0

Tuşa basılmış değil.

LButton 1

Sol fare düğmesi.

RButton 2

Sağ fare düğmesi.

Cancel 3

CANCEL anahtarı.

MButton 4

Ortadaki fare düğmesi (üç düğmeli fare).

XButton1 5

İlk x fare düğmesi (beş düğmeli fare).

XButton2 6

İkinci x fare düğmesi (beş düğmeli fare).

Back 8

GERİ AL tuşu.

Tab 9

SEKME tuşu.

LineFeed 10

LINEFEED anahtarı.

Clear 12

CLEAR tuşu.

Enter 13

ENTER anahtarı.

Return 13

RETURN anahtarı.

ShiftKey 16

SHIFT tuşu.

ControlKey 17

CTRL tuşu.

Menu 18

ALT tuşu.

Pause 19

PAUSE tuşu.

Capital 20

CAPS LOCK tuşu.

CapsLock 20

CAPS LOCK tuşu.

HanguelMode 21

IME Hanguel modu anahtarı. (uyumluluk için korunur; kullanın HangulMode)

HangulMode 21

IME Hangul modu anahtarı.

KanaMode 21

IME Kana modu anahtarı.

JunjaMode 23

IME Junja mod tuşu.

FinalMode 24

IME son mod anahtarı.

HanjaMode 25

IME Hanja mod tuşu.

KanjiMode 25

IME Kanji modu anahtarı.

Escape 27

ESC anahtarı.

IMEConvert 28

IME dönüştürme anahtarı.

IMENonconvert 29

IME nonconvert anahtarı.

IMEAccept 30

IME accept anahtarı, öğesinin yerini alır IMEAceept.

IMEAceept 30

IME kabul anahtarı. Kullanımdan kaldırıldı, bunun yerine kullanın IMEAccept .

IMEModeChange 31

IME modu değişiklik anahtarı.

Space 32

ARA ÇUBUĞU anahtarı.

PageUp 33

PAGE UP tuşu.

Prior 33

PAGE UP tuşu.

Next 34

PAGE DOWN tuşu.

PageDown 34

PAGE DOWN tuşu.

End 35

END tuşu.

Home 36

HOME tuşu.

Left 37

SOL OK tuşu.

Up 38

YUKARI OK tuşu.

Right 39

SAĞ OK tuşu.

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

Snapshot 44

PRINT SCREEN tuşu.

Insert 45

INS anahtarı.

Delete 46

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

LWin 91

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

RWin 92

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

Apps 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 anahtarı.

Add 107

Ekleme anahtarı.

Separator 108

Ayırıcı anahtar.

Subtract 109

Çıkarma anahtarı.

Decimal 110

Ondalık anahtar.

Divide 111

Bölme anahtarı.

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

NumLock 144

NUM LOCK tuşu.

Scroll 145

SCROLL LOCK tuşu.

LShiftKey 160

Sol SHIFT tuşu.

RShiftKey 161

Sağ SHIFT tuşu.

LControlKey 162

Soldaki CTRL tuşu.

RControlKey 163

Sağ CTRL tuşu.

LMenu 164

Sol ALT tuşu.

RMenu 165

Sağ ALT tuşu.

BrowserBack 166

Tarayıcı arka tuşu.

BrowserForward 167

Tarayıcı iletme anahtarı.

BrowserRefresh 168

Tarayıcı yenileme anahtarı.

BrowserStop 169

Tarayıcı durdurma anahtarı.

BrowserSearch 170

Tarayıcı arama anahtarı.

BrowserFavorites 171

Tarayıcı sık kullanılanlar tuşu.

BrowserHome 172

Tarayıcı giriş anahtarı.

VolumeMute 173

Birim sesi kapatma anahtarı.

VolumeDown 174

Ses düzeyi azaltma tuşu.

VolumeUp 175

Birim yukarı anahtarı.

MediaNextTrack 176

Medya sonraki izleme anahtarı.

MediaPreviousTrack 177

Medya önceki izleme anahtarı.

MediaStop 178

Medya Durdurma tuşu.

MediaPlayPause 179

Medya yürütme duraklatma tuşu.

LaunchMail 180

Başlatma posta anahtarı.

SelectMedia 181

Medya seçin anahtarı.

LaunchApplication1 182

Başlangıç uygulaması bir anahtar.

LaunchApplication2 183

Başlangıç uygulaması iki anahtarı.

Oem1 186

OEM 1 anahtarı.

OemSemicolon 186

ABD standart klavyesinde OEM Noktalı Virgül tuşu.

Oemplus 187

Herhangi bir ülke/bölge klavyesinde OEM artı 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önem tuşu.

Oem2 191

OEM 2 anahtarı.

OemQuestion 191

ABD standart klavyesinde OEM soru işareti tuşu.

Oem3 192

OEM 3 anahtarı.

Oemtilde 192

ABD standart klavyesinde OEM tilde tuşu.

Oem4 219

OEM 4 anahtarı.

OemOpenBrackets 219

ABD standart klavyesinde OEM açık köşeli ayraç tuşu.

Oem5 220

OEM 5 anahtarı.

OemPipe 220

ABD standart klavyesinde OEM boru tuşu.

Oem6 221

OEM 6 anahtarı.

OemCloseBrackets 221

ABD standart klavyesinde OEM kapatma köşeli ayraç tuşu.

Oem7 222

OEM 7 anahtarı.

OemQuotes 222

ABD standart klavyesinde OEM tekli/çift tırnak tuşu.

Oem8 223

OEM 8 anahtarı.

Oem102 226

OEM 102 anahtarı.

OemBackslash 226

RT 102 tuş klavyesinde OEM açılı ayraç veya ters eğik çizgi tuşu.

ProcessKey 229

İşlem ANAHTARı anahtarı.

Packet 231

Unicode karakterlerini tuş vuruşu gibi geçirmek için kullanılır. Paket anahtarı değeri, klavye dışı giriş yöntemleri için kullanılan 32 bit sanal anahtar değerinin düşük sözcüğüdür.

Attn 246

ATTN anahtarı.

Crsel 247

CRSEL anahtarı.

Exsel 248

EXSEL anahtarı.

EraseEof 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 tuşu.

KeyCode 65535

Anahtar değerinden anahtar kodu ayıklamak için bit maskesi.

Shift 65536

SHIFT değiştirici tuşu.

Control 131072

CTRL değiştirici tuşu.

Alt 262144

ALT değiştirici anahtarı.

Örnekler

Aşağıdaki kod örneği, denetime KeyDown girilen karakter türünü belirlemek için olayını kullanır.

   // Boolean flag used to determine when a character other than a number is entered.
private:
   bool nonNumberEntered;

   // Handle the KeyDown event to determine the type of character entered into the control.
   void textBox1_KeyDown( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e )
   {
      // Initialize the flag to false.
      nonNumberEntered = false;

      // Determine whether the keystroke is a number from the top of the keyboard.
      if ( e->KeyCode < Keys::D0 || e->KeyCode > Keys::D9 )
      {
         // Determine whether the keystroke is a number from the keypad.
         if ( e->KeyCode < Keys::NumPad0 || e->KeyCode > Keys::NumPad9 )
         {
            // Determine whether the keystroke is a backspace.
            if ( e->KeyCode != Keys::Back )
            {
               // A non-numerical keystroke was pressed.
               // Set the flag to true and evaluate in KeyPress event.
               nonNumberEntered = true;
            }
         }
      }
      //If shift key was pressed, it's not a number.
      if (Control::ModifierKeys == Keys::Shift) {
         nonNumberEntered = true;
      }
   }

   // This event occurs after the KeyDown event and can be used to prevent
   // characters from entering the control.
   void textBox1_KeyPress( Object^ /*sender*/, System::Windows::Forms::KeyPressEventArgs^ e )
   {
      // Check for the flag being set in the KeyDown event.
      if ( nonNumberEntered)
      {         // Stop the character from being entered into the control since it is non-numerical.
         e->Handled = true;
      }
   }
// Boolean flag used to determine when a character other than a number is entered.
private bool nonNumberEntered = false;

// Handle the KeyDown event to determine the type of character entered into the control.
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
    // Initialize the flag to false.
    nonNumberEntered = false;

    // Determine whether the keystroke is a number from the top of the keyboard.
    if (e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9)
    {
        // Determine whether the keystroke is a number from the keypad.
        if (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9)
        {
            // Determine whether the keystroke is a backspace.
            if(e.KeyCode != Keys.Back)
            {
                // A non-numerical keystroke was pressed.
                // Set the flag to true and evaluate in KeyPress event.
                nonNumberEntered = true;
            }
        }
    }
    //If shift key was pressed, it's not a number.
    if (Control.ModifierKeys == Keys.Shift) {
        nonNumberEntered = true;
    }
}

// This event occurs after the KeyDown event and can be used to prevent
// characters from entering the control.
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
    // Check for the flag being set in the KeyDown event.
    if (nonNumberEntered)
    {
        // Stop the character from being entered into the control since it is non-numerical.
        e.Handled = true;
    }
}
 ' Boolean flag used to determine when a character other than a number is entered.
 Private nonNumberEntered As Boolean = False


 ' Handle the KeyDown event to determine the type of character entered into the control.
 Private Sub textBox1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) _
      Handles textBox1.KeyDown
     ' Initialize the flag to false.
     nonNumberEntered = False
   
     ' Determine whether the keystroke is a number from the top of the keyboard.
     If e.KeyCode < Keys.D0 OrElse e.KeyCode > Keys.D9 Then
         ' Determine whether the keystroke is a number from the keypad.
         If e.KeyCode < Keys.NumPad0 OrElse e.KeyCode > Keys.NumPad9 Then
             ' Determine whether the keystroke is a backspace.
             If e.KeyCode <> Keys.Back Then
                 ' A non-numerical keystroke was pressed. 
                 ' Set the flag to true and evaluate in KeyPress event.
                 nonNumberEntered = True
             End If
         End If
     End If
     'If shift key was pressed, it's not a number.
     If Control.ModifierKeys = Keys.Shift Then
         nonNumberEntered = true
     End If
 End Sub


 ' This event occurs after the KeyDown event and can be used 
 ' to prevent characters from entering the control.
 Private Sub textBox1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) _
     Handles textBox1.KeyPress
     ' Check for the flag being set in the KeyDown event.
     If nonNumberEntered = True Then
         ' Stop the character from being entered into the control since it is non-numerical.
         e.Handled = True
     End If
 End Sub

Açıklamalar

sınıfı, Keys klavye girişini işlemeye yönelik sabitler içerir. Anahtarlar numaralandırmasının üyeleri bir anahtar kodundan ve tek bir tamsayı değeriyle birleştirilmiş bir değiştirici kümesinden oluşur. Win32 uygulama programlama arabiriminde (API) anahtar değeri iki yarıya sahiptir; anahtar kodu içeren yüksek sıralı bitler (Windows sanal anahtar koduyla aynıdır) ve SHIFT, CONTROL ve ALT anahtarları gibi anahtar değiştiricileri temsil eden düşük sıralı bitler.

Warning

Bu numaralandırmadaki değerleri birleştirilmiş bit düzeyinde işlemler için kullanmayın. Numaralandırmadaki değerler birbirini dışlamaz.

Note

Bu numaralandırma, CAPS LOCK veya NUM LOCK anahtarlarının şu anda etkinleştirilip etkinleştirilmediğini test etmek için hiçbir yol sağlamaz. Bu anahtarların etkinleştirilip etkinleştirilmediğini belirlemek için aşağıdaki tekniklerden birini kullanabilirsiniz:

  • IsKeyLocked sınıfının yöntemini çağırınControl.

  • Daha ayrıntılı denetim için user32.dlliçinde tanımlanan Windows API işlevlerini GetKeyState, GetAsyncKeyState veya GetKeyboardState kullanın. Yerel işlevleri çağırma hakkında daha fazla bilgi için bkz . Yönetilmeyen DLL İşlevlerini Kullanma.

Aşağıdaki tabloda, hem genel özgün donanım üreticisi (OEM) anahtarlarını hem de daha özel ABD klavye ilişkilendirmelerini temsil eden iki numaralandırılmış değerle temsil edilen anahtar kodu değerleri gösterilmektedir.

Onaltılık değer ABD klavyesi Genel OEM
Sanat Lisansı OemSemicolon Oem1
BF OemQuestion Oem2
C0 Oemtilde Oem3
DB OemOpenBrackets Oem4
DC OemPipe Oem5
DD OemCloseBrackets Oem6
Almanya OemQuotes Oem7
E2 OemBackslash Oem102

Caution

.NET Framework 2.0 için, önceki girişin (IMEAccept) yanlış yazılmış olan bir üye IMEAceept eklendi. Eski sürüm geriye dönük uyumluluk için korundu, ancak .NET sonraki sürümlerinde silinebilir.

Şunlara uygulanır

Ayrıca bkz.