This repository has been archived by the owner on Nov 20, 2023. It is now read-only.
/
Form1.cs
43 lines (39 loc) · 1.56 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.Commands;
using DevExpress.XtraRichEdit.Keyboard;
using DevExpress.Services.Implementation;
using DevExpress.XtraRichEdit.Services.Implementation;
using DevExpress.Services;
namespace CommandShortcutChange
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
#region #assignshortcutkey
// Register a new shortcut for the RichEditControl without bars
richEditControl1.RemoveShortcutKey(Keys.Control | Keys.Shift, Keys.D8);
richEditControl1.AssignShortcutKeyToCommand(Keys.Control, Keys.G, RichEditCommandId.ToggleShowWhitespace);
// Register a new shortcut for the RichEditControl with bars
richEditControl2.RemoveShortcutKey(Keys.Control | Keys.Shift, Keys.D8);
foreach (DevExpress.XtraBars.BarItem item in barManager1.Items)
{
if (item.GetType() == typeof(DevExpress.XtraRichEdit.UI.ToggleShowWhitespaceItem))
item.ItemShortcut = new DevExpress.XtraBars.BarShortcut((Keys.Control | Keys.G));
}
#endregion #assignshortcutkey
}
private void barManager1_ShortcutItemClick(object sender, DevExpress.XtraBars.ShortcutItemClickEventArgs e)
{
e.Cancel = !(FindForm().ActiveControl == richEditControl2);
}
}
}