mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-27 02:34:41 +00:00
解决全局热键不能录制Alt组合键的问题
This commit is contained in:
parent
eeab8e4a90
commit
f550f48295
4 changed files with 13 additions and 12 deletions
Binary file not shown.
0
.vs/v2rayN/FileContentIndex/read.lock
Normal file
0
.vs/v2rayN/FileContentIndex/read.lock
Normal file
BIN
.vs/v2rayN/v17/.wsuo
Normal file
BIN
.vs/v2rayN/v17/.wsuo
Normal file
Binary file not shown.
|
|
@ -54,23 +54,24 @@ namespace v2rayN.Views
|
||||||
Utils.SetDarkBorder(this, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(this, _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void TxtGlobalHotkey_KeyDown(object sender, KeyEventArgs e)
|
private void TxtGlobalHotkey_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
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 txt = ((TextBox)sender);
|
||||||
var index = Utils.ToInt(txt.Name.Substring(txt.Name.Length - 1, 1));
|
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);
|
||||||
if (e.Key == Key.System)
|
|
||||||
return;
|
|
||||||
var formsKey = (Forms.Keys)KeyInterop.VirtualKeyFromKey(e.Key);
|
|
||||||
|
|
||||||
lstKey[index].KeyCode = formsKey;
|
lstKey[index].KeyCode = formsKey;
|
||||||
lstKey[index].Alt = Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt);
|
lstKey[index].Alt = (Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt;
|
||||||
lstKey[index].Control = Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl);
|
lstKey[index].Control = (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control;
|
||||||
lstKey[index].Shift = Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift);
|
lstKey[index].Shift = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift;
|
||||||
|
|
||||||
BindingData(index);
|
BindingData(index);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void BindingData(int index)
|
private void BindingData(int index)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue