System.Windows.Forms.Keys Enumeration

Specifies key codes and modifiers.

Syntax

[System.ComponentModel.Editor("System.Windows.Forms.Design.ShortcutKeysEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.KeysConverter))]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Flags]
public enum Keys

Remarks

The System.Windows.Forms.Keys class contains constants for processing keyboard input. The members of the Keys enumeration consist of a key code and a set of modifiers combined into a single integer value. In the Win32 application programming interface (API) a key value has two halves, with the high-order bits containing the key code (which is the same as a Windows virtual key code), and the low-order bits representing key modifiers such as the SHIFT, CONTROL, and ALT keys.

Note:

Do not use the values in this enumeration for combined bitwise operations. The values in the enumeration are not mutually exclusive.

Note:

This enumeration provides no way to test whether the CAPS LOCK or NUM LOCK keys are currently activated. You can use one of the following techniques to determine if these keys are activated:

The following table shows the key code values represented by two enumerated values, representing both the general original equipment manufacturer (OEM) keys and the more specific U.S.-keyboard associations.

BA

Keys.OemSemicolon

Keys.Oem1

BF

Keys.OemQuestion

Keys.Oem2

C0

Keys.Oemtilde

Keys.Oem3

DB

Keys.OemOpenBrackets

Keys.Oem4

DC

Keys.OemPipe

Keys.Oem5

DD

Keys.OemCloseBrackets

Keys.Oem6

DE

Keys.OemQuotes

Keys.Oem7

E2

Keys.OemBackslash

Keys.Oem102

Note:

For the .NET Framework 2.0, a member Keys.IMEAccept was added that supersedes the previous entry, Keys.IMEAceept, which was spelled incorrectly. The older version has been retained for backward compatibility, but it may be deleted in future versions of the .NET Framework

Members

Member NameDescription
A

The A key.

Add

The add key.

Alt

The ALT modifier key.

Apps

The application key (Microsoft Natural Keyboard).

Attn

The ATTN key.

B

The B key.

Back

The BACKSPACE key.

BrowserBack

The browser back key (Windows 2000 or later).

BrowserFavorites

The browser favorites key (Windows 2000 or later).

BrowserForward

The browser forward key (Windows 2000 or later).

BrowserHome

The browser home key (Windows 2000 or later).

BrowserRefresh

The browser refresh key (Windows 2000 or later).

BrowserSearch

The browser search key (Windows 2000 or later).

BrowserStop

The browser stop key (Windows 2000 or later).

C

The C key.

Cancel

The CANCEL key.

Capital

The CAPS LOCK key.

CapsLock

The CAPS LOCK key.

Clear

The CLEAR key.

Control

The CTRL modifier key.

ControlKey

The CTRL key.

Crsel

The CRSEL key.

D

The D key.

D0

The 0 key.

D1

The 1 key.

D2

The 2 key.

D3

The 3 key.

D4

The 4 key.

D5

The 5 key.

D6

The 6 key.

D7

The 7 key.

D8

The 8 key.

D9

The 9 key.

Decimal

The decimal key.

Delete

The DEL key.

Divide

The divide key.

Down

The DOWN ARROW key.

E

The E key.

End

The END key.

Enter

The ENTER key.

EraseEof

The ERASE EOF key.

Escape

The ESC key.

Execute

The EXECUTE key.

Exsel

The EXSEL key.

F

The F key.

F1

The F1 key.

F10

The F10 key.

F11

The F11 key.

F12

The F12 key.

F13

The F13 key.

F14

The F14 key.

F15

The F15 key.

F16

The F16 key.

F17

The F17 key.

F18

The F18 key.

F19

The F19 key.

F2

The F2 key.

F20

The F20 key.

F21

The F21 key.

F22

The F22 key.

F23

The F23 key.

F24

The F24 key.

F3

The F3 key.

F4

The F4 key.

F5

The F5 key.

F6

The F6 key.

F7

The F7 key.

F8

The F8 key.

F9

The F9 key.

FinalMode

The IME final mode key.

G

The G key.

H

The H key.

HanguelMode

The IME Hanguel mode key. (maintained for compatibility; use HangulMode)

HangulMode

The IME Hangul mode key.

HanjaMode

The IME Hanja mode key.

Help

The HELP key.

Home

The HOME key.

I

The I key.

IMEAccept

The IME accept key, replaces Keys.IMEAceept.

IMEAceept

The IME accept key. Obsolete, use Keys.IMEAccept instead.

IMEConvert

The IME convert key.

IMEModeChange

The IME mode change key.

IMENonconvert

The IME nonconvert key.

Insert

The INS key.

J

The J key.

JunjaMode

The IME Junja mode key.

K

The K key.

KanaMode

The IME Kana mode key.

KanjiMode

The IME Kanji mode key.

KeyCode

The bitmask to extract a key code from a key value.

L

The L key.

LaunchApplication1

The start application one key (Windows 2000 or later).

LaunchApplication2

The start application two key (Windows 2000 or later).

LaunchMail

The launch mail key (Windows 2000 or later).

LButton

The left mouse button.

LControlKey

The left CTRL key.

Left

The LEFT ARROW key.

LineFeed

The LINEFEED key.

LMenu

The left ALT key.

LShiftKey

The left SHIFT key.

LWin

The left Windows logo key (Microsoft Natural Keyboard).

M

The M key.

MButton

The middle mouse button (three-button mouse).

MediaNextTrack

The media next track key (Windows 2000 or later).

MediaPlayPause

The media play pause key (Windows 2000 or later).

MediaPreviousTrack

The media previous track key (Windows 2000 or later).

MediaStop

The media Stop key (Windows 2000 or later).

Menu

The ALT key.

Modifiers

The bitmask to extract modifiers from a key value.

Multiply

The multiply key.

N

The N key.

Next

The PAGE DOWN key.

NoName

A constant reserved for future use.

None

No key pressed.

NumLock

The NUM LOCK key.

NumPad0

The 0 key on the numeric keypad.

NumPad1

The 1 key on the numeric keypad.

NumPad2

The 2 key on the numeric keypad.

NumPad3

The 3 key on the numeric keypad.

NumPad4

The 4 key on the numeric keypad.

NumPad5

The 5 key on the numeric keypad.

NumPad6

The 6 key on the numeric keypad.

NumPad7

The 7 key on the numeric keypad.

NumPad8

The 8 key on the numeric keypad.

NumPad9

The 9 key on the numeric keypad.

O

The O key.

Oem1

The OEM 1 key.

Oem102

The OEM 102 key.

Oem2

The OEM 2 key.

Oem3

The OEM 3 key.

Oem4

The OEM 4 key.

Oem5

The OEM 5 key.

Oem6

The OEM 6 key.

Oem7

The OEM 7 key.

Oem8

The OEM 8 key.

OemBackslash

The OEM angle bracket or backslash key on the RT 102 key keyboard (Windows 2000 or later).

OemClear

The CLEAR key.

OemCloseBrackets

The OEM close bracket key on a US standard keyboard (Windows 2000 or later).

Oemcomma

The OEM comma key on any country/region keyboard (Windows 2000 or later).

OemMinus

The OEM minus key on any country/region keyboard (Windows 2000 or later).

OemOpenBrackets

The OEM open bracket key on a US standard keyboard (Windows 2000 or later).

OemPeriod

The OEM period key on any country/region keyboard (Windows 2000 or later).

OemPipe

The OEM pipe key on a US standard keyboard (Windows 2000 or later).

Oemplus

The OEM plus key on any country/region keyboard (Windows 2000 or later).

OemQuestion

The OEM question mark key on a US standard keyboard (Windows 2000 or later).

OemQuotes

The OEM singled/double quote key on a US standard keyboard (Windows 2000 or later).

OemSemicolon

The OEM Semicolon key on a US standard keyboard (Windows 2000 or later).

Oemtilde

The OEM tilde key on a US standard keyboard (Windows 2000 or later).

P

The P key.

Pa1

The PA1 key.

Packet

Used to pass Unicode characters as if they were keystrokes. The Packet key value is the low word of a 32-bit virtual-key value used for non-keyboard input methods.

PageDown

The PAGE DOWN key.

PageUp

The PAGE UP key.

Pause

The PAUSE key.

Play

The PLAY key.

Print

The PRINT key.

PrintScreen

The PRINT SCREEN key.

Prior

The PAGE UP key.

ProcessKey

The PROCESS KEY key.

Q

The Q key.

R

The R key.

RButton

The right mouse button.

RControlKey

The right CTRL key.

Return

The RETURN key.

Right

The RIGHT ARROW key.

RMenu

The right ALT key.

RShiftKey

The right SHIFT key.

RWin

The right Windows logo key (Microsoft Natural Keyboard).

S

The S key.

Scroll

The SCROLL LOCK key.

Select

The SELECT key.

SelectMedia

The select media key (Windows 2000 or later).

Separator

The separator key.

Shift

The SHIFT modifier key.

ShiftKey

The SHIFT key.

Sleep

The computer sleep key.

Snapshot

The PRINT SCREEN key.

Space

The SPACEBAR key.

Subtract

The subtract key.

T

The T key.

Tab

The TAB key.

U

The U key.

Up

The UP ARROW key.

V

The V key.

VolumeDown

The volume down key (Windows 2000 or later).

VolumeMute

The volume mute key (Windows 2000 or later).

VolumeUp

The volume up key (Windows 2000 or later).

W

The W key.

X

The X key.

XButton1

The first x mouse button (five-button mouse).

XButton2

The second x mouse button (five-button mouse).

Y

The Y key.

Z

The Z key.

Zoom

The ZOOM key.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0