双击定时器事件

发布于 2025-01-01 21:43:54 字数 211 浏览 0 评论 0原文

我正在开发一个应用程序,将用户的眼球运动与光标运动映射起来,从而开发一个免提光标控制系统。

我正在使用 Open CV 库的 .NET Wrapper for C# 即 Emgu CV 进行开发。

我被困在想要打开文件/文件夹的地方,这样当光标放在文件/文件夹上 3 到 5 秒时,文件/文件夹应该打开或只执行双击事件传统的鼠标。

我可以用什么来解决这个问题?

I am developing an application that maps users eye movements with the cursor movements, hence developing ahands free cursor control system.

I am using Open CV library's .NET Wrapper for C# i.e. Emgu CV for development.

I am stuck at a point where I want to open a file/folder such that when a cursor is placed over a file/folder for say 3 to 5 seconds, the file/folder should open up or just perform a double-click event of a conventional mouse.

What could I use so as to solve this problem?

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

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

发布评论

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

评论(3

舂唻埖巳落 2025-01-08 21:43:54
    Timer timer = new System.Timers.Timer(5000);//5 seconds
    timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);

    private void form_MouseHover(object sender, System.EventArgs e) 
    {            
        timer.Start();
    }

    private void form_MouseLeave(object sender, System.EventArgs e) 
    {            
        timer.Stop();
    }

    void timer_Elapsed(object sender, ElapsedEventArgs e)
    {
        timer.Stop();
        OpenFileOrFolder();//Edit : implement your file / folder opening logic here
    }
    Timer timer = new System.Timers.Timer(5000);//5 seconds
    timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);

    private void form_MouseHover(object sender, System.EventArgs e) 
    {            
        timer.Start();
    }

    private void form_MouseLeave(object sender, System.EventArgs e) 
    {            
        timer.Stop();
    }

    void timer_Elapsed(object sender, ElapsedEventArgs e)
    {
        timer.Stop();
        OpenFileOrFolder();//Edit : implement your file / folder opening logic here
    }
○愚か者の日 2025-01-08 21:43:54

我想你需要将其分解:

  1. 检测鼠标何时移动或悬停
  2. 发送双击

对于1,我会查看:捕获 WM_MOUSEMOVE 如果您想要自己的定义'盘旋'。例如,对于您可以容忍的移动量有一个更大的阈值,但仍然将其视为“悬停”。或者,您可以使用操作系统定义的阈值并查找 WM_MOUSEHOVER

对于 2,SendInput 应该可以让你到达那里

我在这里假设,您实际上并不关心鼠标本身下方的内容。例如,您不会根据鼠标下方的内容执行不同的行为。例如,当您将鼠标悬停在标题栏上以及将鼠标悬停在文件上时,您将发送双击。

这篇文章关于项目构建了一个 Spy++ 风格的应用程序,这应该有帮助。

I guess you need to break it down:

  1. Detect when the mouse moves or hovers
  2. Send a double click

For 1, I'd be looking at: capturing WM_MOUSEMOVE if you want your own definition of 'hovering'. For example, having a greater threshold for how much movement you'll tolerate and still consider it a 'hover'. Or, you could use the OS defined threshold and look for WM_MOUSEHOVER

For 2, SendInput should get you there

I'm assuming here, you don't actually care what's under the mouse per-se. As in, you're not going to do different behavior depending on what's under the mouse. For example, you'd send the double click when hovering over the titlebar, as well as if you were hovering over the file.

This article on project builds up a Spy++ style app, which should help.

你曾走过我的故事 2025-01-08 21:43:54

您是否将目视控制映射到鼠标指针? MouseHover 事件可能有用:

http:// msdn.microsoft.com/en-us/library/system.windows.forms.control.mousehover.aspx

以及 MouseEnter、MouseLeave 等。

如果您控制的是单独的元素(即,不是鼠标)用眼睛,然后我必须在 WPF 中做类似的事情。最终归结为将控件坐标映射到鼠标位置,计算该控件范围内的时间,然后调用鼠标单击事件处理程序。

Are you mapping eye control to the mouse pointer? The MouseHover event may be useful:

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.mousehover.aspx

As well as MouseEnter, MouseLeave, etc.

If you're controlling a separate element (i.e., not the mouse) with the eyes, then I had to do something similar in WPF. It ultimately came down to mapping control coordinates to mouse location, counting the time within the bounds of that control, then calling the mouse click event handler.

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