TextBox.ProcessCmdKey(Message, Keys) 方法

定义

处理命令键。Processes a command key.

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

参数

m
Message

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

keyData
Keys

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

返回

如果命令键已由控件处理,则为 true;否则为 falsetrue if the command key was processed by the control; otherwise, false.

注解

4.6.1 中的新增项。New in 4.6.1. 在以前的版本中,当 ShortcutsEnabledMultiline 属性都设置为 true.时,TextBox 中的 Ctrl 键无法选择所有文本。In previous versions, the Ctrl-A shortcut key in a TextBox failed to select all text when the ShortcutsEnabled and Multiline properties were both set to true.. ShortcutsEnabledMultiline 属性都设置为时,此方法将启用 Ctrl 键以选择所有文本 true.This method enables the Ctrl-A shortcut key to select all text when the ShortcutsEnabled and Multiline properties are both set to true.

面向 .NET Framework 版本4.0 到4.6 的应用程序可以通过将以下内容添加到 app.config 文件的 <runtime> 部分来利用此方法:Applications targeting .NET Framework versions 4.0 through 4.6 can take advantage of this method by adding the following to the <runtime> section of the app.config file:

<AppContextSwitchOverrides value = "Switch.System.Windows.Forms.DoNotSupportSelectAllShortcutInMultilineTextBox=false" />  

面向 .NET Framework 版本4.6.1 或更高版本的应用程序可以通过将以下内容添加到 app.config 文件的 <runtime> 部分来选择退出此行为:Applications targeting .NET Framework versions 4.6.1 or newer can opt out of this behavior by adding the following to the <runtime> section of the app.config file:

<AppContextSwitchOverrides value = "Switch.System.Windows.Forms.DoNotSupportSelectAllShortcutInMultilineTextBox=true" />  

备注

如果 app.config 文件中已包含 AppContextSwitchOverrides 项,请将新的键值合并到现有的密钥中。If the app.config file already contains an AppContextSwitchOverrides key, merge the new key value into the existing key. 例如 <AppContextSwitchOverrides value = "oldKey=oldValue;Switch.System.Windows.Forms.DoNotSupportSelectAllShortcutInMultilineTextBox=false" />For example, <AppContextSwitchOverrides value = "oldKey=oldValue;Switch.System.Windows.Forms.DoNotSupportSelectAllShortcutInMultilineTextBox=false" />.

安全性

SecurityPermission
用于处理非托管代码。for operating with unmanaged code. 关联的枚举: UnmanagedCodeAssociated enumeration: UnmanagedCode

适用于