TextBox::ProcessCmdKey Method (Message%, Keys)
Processes a command key.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
protected: [SecurityPermissionAttribute(SecurityAction::LinkDemand, Flags = SecurityPermissionFlag::UnmanagedCode)] virtual bool ProcessCmdKey( Message% m, Keys keyData ) override
Parameters
- m
-
Type:
System.Windows.Forms::Message%
A Message, passed by reference that represents the window message to process.
- keyData
-
Type:
System.Windows.Forms::Keys
One of the Keys values that represents the shortcut key to process.
Return Value
Type: System::Booleantrue if the command key was processed by the control; otherwise, false.
New in 4.6.1. 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.. This method enables the Ctrl-A shortcut key to select all text when the ShortcutsEnabled and Multiline properties are both set to true.
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" />
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" />
Note |
|---|
If the app.config file already contains an AppContextSwitchOverrides key, merge the new key value into the existing key. For example, <AppContextSwitchOverrides value = "oldKey=oldValue;Switch.System.Windows.Forms.DoNotSupportSelectAllShortcutInMultilineTextBox=false" />. |
for operating with unmanaged code. Associated enumeration: UnmanagedCode
Available since 4.6.1
