Bewerken

Share via


ToolStripControlHost.OnKeyPress(KeyPressEventArgs) Method

Definition

Raises the KeyPress event.

protected:
 virtual void OnKeyPress(System::Windows::Forms::KeyPressEventArgs ^ e);
protected virtual void OnKeyPress (System.Windows.Forms.KeyPressEventArgs e);
abstract member OnKeyPress : System.Windows.Forms.KeyPressEventArgs -> unit
override this.OnKeyPress : System.Windows.Forms.KeyPressEventArgs -> unit
Protected Overridable Sub OnKeyPress (e As KeyPressEventArgs)

Parameters

e
KeyPressEventArgs

A KeyPressEventArgs that contains the event data.

Remarks

Raising an event invokes the event handler through a delegate. For more information, see Handling and Raising Events.

The OnKeyPress method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Notes to Inheritors

When overriding OnKeyPress(KeyPressEventArgs) in a derived class, be sure to call the base class's OnKeyPress(KeyPressEventArgs) method so that registered delegates receive the event.

Applies to