Merge pull request #3382 from hvvvvvvv/master

解决全局热键不能录制Alt组合键的问题
pull/3405/head^2
2dust 2 years ago committed by GitHub
commit 0b37e36036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -57,19 +57,21 @@ namespace v2rayN.Views
private void TxtGlobalHotkey_KeyDown(object sender, KeyEventArgs e)
{
var txt = ((TextBox)sender);
var index = Utils.ToInt(txt.Name.Substring(txt.Name.Length - 1, 1));
if (e.Key == Key.System)
return;
var formsKey = (Forms.Keys)KeyInterop.VirtualKeyFromKey(e.Key);
e.Handled = true;
var _ModifierKeys = new Key[] { Key.LeftCtrl, Key.RightCtrl, Key.LeftShift, Key.RightShift, Key.LeftAlt, Key.RightAlt };
if (!_ModifierKeys.Contains(e.Key) && !_ModifierKeys.Contains(e.SystemKey))
{
var txt = ((TextBox)sender);
var index = Utils.ToInt(txt.Name.Substring(txt.Name.Length - 1, 1));
var formsKey = (Forms.Keys)KeyInterop.VirtualKeyFromKey(e.Key == Key.System ? e.SystemKey : e.Key);
lstKey[index].KeyCode = formsKey;
lstKey[index].Alt = Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt);
lstKey[index].Control = Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl);
lstKey[index].Shift = Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift);
lstKey[index].KeyCode = formsKey;
lstKey[index].Alt = (Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt;
lstKey[index].Control = (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control;
lstKey[index].Shift = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift;
BindingData(index);
BindingData(index);
}
}
private void BindingData(int index)

Loading…
Cancel
Save