Occurs when a key is pressed and the shape has focus.
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Key events occur in the following order:
Use the KeyChar property to sample keystrokes at run time and to consume or modify a subset of common keystrokes.
For more information about how to handle events, see Consuming Events.
The following example shows how to respond to the KeyPress event in an event handler. This example requires that you have a RectangleShape control named RectangleShape1 on a form.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.