Back to Devexpress

RichEditControl.RemoveShortcutKey(Keys, Keys) Method

windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-dot-removeshortcutkey-x28-system-dot-windows-dot-forms-dot-keys-system-dot-windows-dot-forms-dot-keys-x29.md

latest5.6 KB
Original Source

RichEditControl.RemoveShortcutKey(Keys, Keys) Method

Removes a command shortcut for all RichEdit views.

Namespace : DevExpress.XtraRichEdit

Assembly : DevExpress.XtraRichEdit.v25.2.dll

NuGet Package : DevExpress.Win.RichEdit

Declaration

csharp
public void RemoveShortcutKey(
    Keys key,
    Keys modifier
)
vb
Public Sub RemoveShortcutKey(
    key As Keys,
    modifier As Keys
)

Parameters

NameTypeDescription
keyKeys

A Keys enumeration member specifying a shortcut key.

| | modifier | Keys |

A Keys enumeration member specifying a modifier key.

|

Remarks

To assign a command shortcut, use the RichEditControl.AssignShortcutKeyToCommand method.

Example

The following code assigns Ctrl+G shortcut to ToggleShowWhitespaceCommand and removes predefined Ctrl+N shortcut so that it is no longer in use.

View Example

csharp
using System.Windows.Forms;

richEditControl.Text = "Use 'Ctrl+G' shortcut to show/hide whitespace characters";
richEditControl.Text += "\r\nYou can no longer use the 'Ctrl+N' shortcut to create a new document.";

richEditControl.AssignShortcutKeyToCommand(Keys.Control, Keys.G, RichEditCommandId.ToggleShowWhitespace);
richEditControl.RemoveShortcutKey(Keys.Control, Keys.N);
vb
Imports System.Windows.Forms

richEditControl.Text = "Use 'Ctrl+G' shortcut to show/hide whitespace characters"
richEditControl.Text += Constants.vbCrLf & "You can no longer use the 'Ctrl+N' shortcut to create a new document"

richEditControl.AssignShortcutKeyToCommand(Keys.Control, Keys.G, RichEditCommandId.ToggleShowWhitespace)
richEditControl.RemoveShortcutKey(Keys.Control, Keys.N)

The following code snippets (auto-collected from DevExpress Examples) contain references to the RemoveShortcutKey(Keys, Keys) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L551

csharp
richEditControl.AssignShortcutKeyToCommand(System.Windows.Forms.Keys.Control, System.Windows.Forms.Keys.G, RichEditCommandId.ToggleShowWhitespace);
richEditControl.RemoveShortcutKey(System.Windows.Forms.Keys.Control, System.Windows.Forms.Keys.N);
#endregion #CustomizePredefinedShortcutKeys

rich-text-editor-highlight-syntax/CS/SyntaxHighlightApp/Form1.cs#L19

csharp
InitializeComponent();
richEditControl1.RemoveShortcutKey(System.Windows.Forms.Keys.Enter, System.Windows.Forms.Keys.Shift);

winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L561

vb
richEditControl.AssignShortcutKeyToCommand(System.Windows.Forms.Keys.Control, System.Windows.Forms.Keys.G, RichEditCommandId.ToggleShowWhitespace)
            richEditControl.RemoveShortcutKey(System.Windows.Forms.Keys.Control, System.Windows.Forms.Keys.N)
' #End Region ' #CustomizePredefinedShortcutKeys

rich-text-editor-highlight-syntax/VB/SyntaxHighlightApp/Form1.vb#L19

vb
InitializeComponent()
richEditControl1.RemoveShortcutKey(System.Windows.Forms.Keys.Enter, System.Windows.Forms.Keys.Shift)

See Also

AssignShortcutKeyToCommand

RichEditControl Class

RichEditControl Members

DevExpress.XtraRichEdit Namespace