private void RemoveCommandBinding(ScintillaNET.BindableCommand Command) { List <ScintillaNET.KeyBinding> boundKeys = editSource.Commands.GetKeyBindings(Command); foreach (ScintillaNET.KeyBinding binding in boundKeys) { editSource.Commands.RemoveBinding(binding.KeyCode, binding.Modifiers, Command); //dh.Log( "Remove Binding " + ( binding.KeyCode | binding.Modifiers ) ); } }
private void SetKeyBinding(ScintillaNET.BindableCommand Command, AcceleratorKey Key) { if ((Key == null) || (Key.Key == System.Windows.Forms.Keys.None)) { // nothing defined, leave default key return; } RemoveCommandBinding(Command); editSource.Commands.AddBinding(Key.Key & System.Windows.Forms.Keys.KeyCode, Key.Key & System.Windows.Forms.Keys.Modifiers, Command); //dh.Log( "Set Binding " + Key.Key ); }