Commit c47660e9 by liulongfei

快捷键控件bug修复

parent a8013904
......@@ -22,82 +22,47 @@ namespace VIZ.Framework.Common
StringBuilder sb = new StringBuilder();
// Ctl Alt Shift
if (e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) || e.KeyboardDevice.IsKeyDown(Key.RightCtrl))
if (e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Control))
{
sb.Append("Ctrl + ");
}
if (e.KeyboardDevice.IsKeyDown(Key.LeftAlt) || e.KeyboardDevice.IsKeyDown(Key.RightAlt))
if (e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Alt))
{
sb.Append("Alt + ");
}
if (e.KeyboardDevice.IsKeyDown(Key.LeftShift) || e.KeyboardDevice.IsKeyDown(Key.RightShift))
if (e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Shift))
{
sb.Append("Shift + ");
}
// D0 - D9 A - Z
for (int i = (int)Key.D0; i <= (int)Key.Z; i++)
if (e.SystemKey >= Key.D0 && e.SystemKey <= Key.Z)
{
Key key = (Key)i;
if (e.KeyboardDevice.IsKeyDown(key))
{
sb.Append($"{key}");
break;
}
sb.Append($"{e.SystemKey}");
}
// F1 - F12
for (int i = (int)Key.F1; i <= (int)Key.F12; i++)
if (e.Key >= Key.D0 && e.Key <= Key.Z)
{
Key key = (Key)i;
if (e.KeyboardDevice.IsKeyDown(key))
{
sb.Append($"{key}");
break;
}
sb.Append($"{e.Key}");
}
return sb.ToString();
}
/// <summary>
/// 获取热键值
/// </summary>
/// <param name="e">键盘事件</param>
/// <returns>热键值</returns>
public static string GetHotkey(System.Windows.Forms.KeyEventArgs e)
{
StringBuilder sb = new StringBuilder();
if (e.Control)
{
sb.Append("Ctrl + ");
}
if (e.Alt)
{
sb.Append("Alt + ");
}
if (e.Shift)
// F1 - F12
if (e.SystemKey >= Key.F1 && e.SystemKey <= Key.F12)
{
sb.Append("Shift + ");
sb.Append($"{e.SystemKey}");
}
// D0 - D9
if (e.KeyCode >= System.Windows.Forms.Keys.D0 && e.KeyCode <= System.Windows.Forms.Keys.D9)
if (e.Key >= Key.F1 && e.Key <= Key.F12)
{
sb.Append($"{e.KeyCode}");
return sb.ToString();
sb.Append($"{e.Key}");
}
// A - Z
if (e.KeyCode >= System.Windows.Forms.Keys.A && e.KeyCode <= System.Windows.Forms.Keys.Z)
// Delete
if (e.SystemKey == Key.Delete)
{
sb.Append($"{e.KeyCode}");
return sb.ToString();
sb.Append($"{e.SystemKey}");
}
// F1 - F12
if (e.KeyCode >= System.Windows.Forms.Keys.F1 && e.KeyCode <= System.Windows.Forms.Keys.F12)
if (e.Key == Key.Delete)
{
sb.Append($"{e.KeyCode}");
return sb.ToString();
sb.Append($"{e.Key}");
}
return sb.ToString();
......
......@@ -8,6 +8,6 @@
mc:Ignorable="d" WindowStartupLocation="CenterScreen" WindowState="Maximized"
Title="MainWindow" Height="800" Width="1200">
<Grid>
<local:TallyTest></local:TallyTest>
<local:HotkeyBoxTest></local:HotkeyBoxTest>
</Grid>
</Window>
......@@ -55,11 +55,11 @@ namespace VIZ.Framework.WpfTest
this.video.AttachPlugin(centerAxisPlugin);
// 接入OpenCV插件
OpenCVStreamOption option = new OpenCVStreamOption();
OpenCVStream stream = new OpenCVStream(option);
stream.ExecuteVideoFrame += Stream_ExecuteVideoFrame;
stream.ChangeUri(@"E:\视频\1.mp4");
stream.Play();
//OpenCVStreamOption option = new OpenCVStreamOption();
//OpenCVStream stream = new OpenCVStream(option);
//stream.ExecuteVideoFrame += Stream_ExecuteVideoFrame;
//stream.ChangeUri(@"E:\视频\1.mp4");
//stream.Play();
// 更新矩形框信息
//List<TrackingBoxInfo> list = new List<TrackingBoxInfo>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment