STK XSend comments on this topic.
KeyDown Event (AgUiAxGfxAnalysisCntrl)
See Also
KeyCode
A key code such as System.Windows.Forms.Keys.F1 (the F1 key) or System.Windows.Forms.Keys.Home (the HOME key) in Visual Basic .NET).
Shift
An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys at the time of the event. The Shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT are pressed, the value of Shift is 6.
Windows






Windows & Linux

Description

Occurs when the user presses a key while the control has the focus.

Syntax

[Visual Basic .NET]
Public Event KeyDown( _
    ByRef KeyCode As short, _
    ByVal Shift As short _
) 
[C#]
public void KeyDown(
    ref short KeyCode,
    short Shift
);
[Managed C++]
public: void KeyDown(
    short ^ KeyCode,
    short Shift
);
[Java]
public void keyDown(
    short KeyCode,
    short Shift
);
[Unmanaged C++]
public: void KeyDown(
    short * KeyCode,
    short  Shift
);

Parameters

KeyCode
A key code such as System.Windows.Forms.Keys.F1 (the F1 key) or System.Windows.Forms.Keys.Home (the HOME key) in Visual Basic .NET).
Shift
An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys at the time of the event. The Shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT are pressed, the value of Shift is 6.

Remarks

Although the KeyDown events can apply to most keys, it is most often used for:

  • Extended character keys such as function keys.
  • Navigation keys.
  • Combinations of keys with standard keyboard modifiers.
  • Distinguishing between the numeric keypad and regular number keys.

KeyDown is not invoked for the TAB key.

KeyDown interpret the uppercase and lowercase of each character by means of two arguments: KeyCode, which indicates the physical key (thus returning A and a as the same key) and Shift, which indicates the state of shift+key and therefore returns either A or a.

If you need to test for the Shift argument, you can use the AgEShiftValues constants which define the bits within the argument. The constants act as bit masks that you can use to test for any combination of keys.

In VB.NET the KeyDown event is shown as  "xxxxxxxx_KeyDownEvent" in the IDE.

See Also

Example

[Visual Basic .NET]
Private Sub AxAgUiAxGfxAnalysisCntrl1_KeyDownEvent( _
ByVal sender As Object, _
ByVal e As AxAGI.STKX.IAgUiAxGfxAnalysisCntrlEvents_KeyDownEvent) _
Handles AxAgUiAxGfxAnalysisCntrl1.KeyDownEvent

If (e.keyCode = System.Windows.Forms.Keys.A) And ((e.shift And AGI.STKX.AgEShiftValues.eCtrlPressed) > 0)
' CTRL-a has been key is down!
...
End If

End Sub
© 2020 Analytical Graphics, Inc. All Rights Reserved.