Editar

Compartir a través de


ComboBox.ProcessCmdKey(Message, Keys) Method

Definition

Processes a command key.

protected:
 override bool ProcessCmdKey(System::Windows::Forms::Message % msg, System::Windows::Forms::Keys keyData);
protected override bool ProcessCmdKey (ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData);
override this.ProcessCmdKey : Message * System.Windows.Forms.Keys -> bool
Protected Overrides Function ProcessCmdKey (ByRef msg As Message, keyData As Keys) As Boolean

Parameters

msg
Message

The window message to process, passed by reference.

keyData
Keys

One of the enumeration values that represent the key to process.

Returns

true if the character was processed by the control; otherwise, false.

Remarks

This method is called during message preprocessing to handle command keys. Command keys are keys that always take precedence over regular input keys. Examples of command keys include accelerators and menu shortcuts. The method must return true to indicate that it has processed the command key, or false to indicate that the key is not a command key. This method is only called when the control is hosted in a Windows Forms application or as an ActiveX control.

The ProcessCmdKey method first determines whether the control has a ContextMenu, and if so, enables the ContextMenu to process the command key. If the command key is not a menu shortcut and the control has a parent, the key is passed to the parent's ProcessCmdKey method. The net effect is that command keys are "bubbled" up the control hierarchy. In addition to the key the user pressed, the key data also indicates which, if any, modifier keys were pressed at the same time as the key. Modifier keys include the SHIFT, CTRL, and ALT keys.

Applies to