This document is archived and information here might be outdated.  Recommended version.


ITool.OnKeyDown Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (SystemUI)  

ITool.OnKeyDown Method

Occurs when a key on the keyboard is pressed when this tool is active.

[Visual Basic .NET]
Public Sub OnKeyDown ( _
    ByVal keyCode As Integer, _
    ByVal shift As Integer _
)
[C#]
public void OnKeyDown (
    int keyCode,
    int shift
);
[C++]
HRESULT OnKeyDown(
  long keyCode,
  long shift
);
[C++]

Parameters keyCode [in] keyCode is a parameter of type long shift [in] shift is a parameter of type long

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

keyCode specifies which key on the keyboard was pressed.

Shift indicates whether the Shift key, Ctrl key, or Alt key was pressed when the mouse button was pressed. 0 for no keys pressed. 1 for Shift key pressed. 2 for Ctrl key pressed. 4 for Alt key pressed. If both the Shift key and the Ctrl key were pressed, Shift would be 3. If all three keys were pressed, Shift would be 7.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when a key on the keyboard is pressed when this tool is the active tool in the OnKeyDown method.

See Also

ITool Interface