C#扑捉Ctrl+C、Ctrl+V
1 private void allRulesGrid_KeyDown(object Sender, KeyEventArgs e)
2 {
3 if (e.Modifiers.CompareTo(Keys.Control) == 0 && e.KeyCode == Keys.C)
4 {
5 CopyData();
6 }
7 else if (e.Modifiers.CompareTo(Keys.Control) == 0 && e.KeyCode == Keys.V)
8 {
9 PasteData();
10 }
11 }
2 {
3 if (e.Modifiers.CompareTo(Keys.Control) == 0 && e.KeyCode == Keys.C)
4 {
5 CopyData();
6 }
7 else if (e.Modifiers.CompareTo(Keys.Control) == 0 && e.KeyCode == Keys.V)
8 {
9 PasteData();
10 }
11 }