Form.ProcessCmdKey(Message, Keys) Form.ProcessCmdKey(Message, Keys) Form.ProcessCmdKey(Message, Keys) Form.ProcessCmdKey(Message, Keys) Method

定义

处理命令键。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 :  * System.Windows.Forms.Keys -> bool
Protected Overrides Function ProcessCmdKey (ByRef msg As Message, keyData As Keys) As Boolean

参数

msg
Message Message Message Message

通过引用传递的 Message,它表示要处理的 Win32 消息。A Message, passed by reference, that represents the Win32 message to process.

keyData
Keys Keys Keys Keys

Keys 值之一,表示要处理的键。One of the Keys values that represents the key to process.

返回

如果控件处理并使用击键,则为 true;否则为 false,以允许进一步处理。true if the keystroke was processed and consumed by the control; otherwise, false to allow further processing.

注解

ProcessCmdKey方法重写基The ProcessCmdKey method overrides the base

ContainerControl.ProcessCmdKey 要提供其他处理的主菜单命令键和 MDI 加速器的实现。ContainerControl.ProcessCmdKey implementation to provide additional handling of main menu command keys and MDI accelerators.

有关捕获击键的信息,请参阅如何通过使用视觉对象捕获在控件中的键击C#如何捕获在.NET 中的键击控件通过使用 Visual Basic.NET在 microsoft支持网站。For information about trapping keystrokes, see How to trap keystrokes in controls by using Visual C# and How to trap keystrokes in .NET controls by using Visual Basic .NET in the Microsoft Support website.

适用于

另请参阅