RichEditControl.AssignShortcutKeyToCommand(Keys, Keys, RichEditCommandId) Method

Assigns a shortcut key to a command. The shortcut key is available for all RichEdit views.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v20.1.dll

Declaration

public void AssignShortcutKeyToCommand(
    Keys key,
    Keys modifier,
    RichEditCommandId commandId
)
Public Sub AssignShortcutKeyToCommand(
    key As Keys,
    modifier As Keys,
    commandId As RichEditCommandId
)

Parameters

Name Type Description
key Keys

A Keys enumeration member specifying a key to assign.

modifier Keys

A Keys enumeration member specifying a modifier key.

commandId RichEditCommandId

A RichEditCommandId enumeration member specifying a command.

Remarks

To remove a command shortcut, use the RichEditControl.RemoveShortcutKey method.

Examples

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

richEditControl.Text = "Use 'Ctrl+G' shortcut to show/hide whitespace characters";
richEditControl.Text += "\r\nA new document can not be created by pressing 'Ctrl+N' shortcut since this shortcut is disabled";
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);
See Also