WPF-如何在不使用上、下、左、右箭头键的情况下设置事件上、下、左、右?

发布于 2024-10-15 18:41:46 字数 252 浏览 6 评论 0原文

我正在使用面部跟踪进行 HCI(人机交互)。我正在尝试使用面部控制电脑。

我有 3x3 2 维按钮网格。 1 2 3 4 5 6 7 8 9

假设当前焦点在按钮 5 上。如果我按向上箭头,则焦点将在 2 上,向下箭头焦点将在 8 上,向左箭头 4 和向右箭头 6 上。

我想实现向上、向下、向左的功能和右箭头功能,无需使用上、下、左、右箭头键。我已经做出了左、右、上、下的决定。需要进行哪些事件处理、设置 tabindex 和进一步的处理?

I am doing HCI (Human Computer Interaction) using face tracking. I am trying to control PC using face.

I have 3x3 2 dimensional grid of button.
1 2 3
4 5 6
7 8 9

Suppose, current focus on button 5. if I press up arrow then focus will be on 2, down arrow focus will be on 8 , left arrow 4 and right arrow 6.

I want to implement functionality of Up,Down,Left and Right arrow functionality without using Up,Down,Left and Right arrow key. I have already done taking left,right, up and down decision. What eventhandling, setting up tabindex and further process need to be taken?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扮仙女 2024-10-22 18:41:46

如果您询问如何引发键盘新闻事件,那么我认为您可以使用 SendKeys 类。

我假设您想创建一个程序,使用面部跟踪将用户移动转换为向上向下等按键事件。上面的类有一个 Send() 方法,它接受密钥代码并将密钥传递给活动应用程序。

就像:

SendKeys.Send("{UP}");//For UP arrow key

由于您已经创建了将焦点转移到网格中相应按钮的方法,因此您可以在引发事件时发送相应的键。

然而,FaceDetection 是一项研究级别的任务,您需要自己实现它或找到一些好的库来引发这些事件。


There's an OpenCVDotNet library that can be used to do such thing. Its actually a .Net wrapper for OpenCV library. Head over to their website and see how you van use it.


Update

要在 WPF 中生成按键事件,请查看此 SO 答案。

如何在 C# 中以编程方式生成按键事件?

If you are asking about how to raise Key board press events then i think you can use SendKeys Class.

I assume you want to create a program that uses Face tracking to convert user movement in to UP DOWN etc Keypress events. Above class has a method Send() method that accepts an keycode and passes the Key to Active Application.

Like:

SendKeys.Send("{UP}");//For UP arrow key

As you have already created methods for shifting focus to respective Buttons in Grid you can just Send the respective key when the Event is raised.

However FaceDetection is a Research level task and you need to implement it yourself or find some good library for raising those events it.


There's an OpenCVDotNet library that can be used to do such thing. Its actually a .Net wrapper for OpenCV library. Head over to their website and see how you van use it.


Update

To generate Key press events in WPF you make look at this SO Answer.

How can I programmatically generate keypress events in C#?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文