Double Click Timer Event

I am developing an application that displays the eye movements of users using cursor movements, thereby creating a free ahands cursor control system.

I am using the Open CV library.NET Wrapper for C # ie Emgu CV for development.

I am stuck at the point where I want to open the file / folder in such a way that when the cursor is placed over the file / folder, say, from 3 to 5 seconds, the file / folder should open or just double-click, click the regular mouse event.

What can I use to solve this problem?

+4
source share
3 answers
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 } 
+1
source

I think you need to break it:

  • Detect when the mouse moves or soars.
  • Double click

For 1, I would look at: capturing WM_MOUSEMOVE if you want your own definition of "freeze". For example, having a larger threshold for how much movement you will endure and still consider it to be β€œstuck”. Or you can use the set OS threshold and look for WM_MOUSEHOVER

For 2, SendInput should get there

I assume that in fact you do not care about what is under your arm. As with the case, you are not going to do other behavior depending on what is under your arm. For example, you send a double click when you hover over the header and also hang over the file.

This project article creates a Spy ++ style application that should help.

+1
source

Do you map eye control to mouse pointer? The MouseHover event can be useful:

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

Just like MouseEnter, MouseLeave, etc.

If you control a single element (i.e. not a mouse) with your eyes, then I had to do something similar in WPF. Ultimately, it came down to comparing the control coordinates with the location of the mouse, counting the time within that control, and then calling the mouse event handler.

0
source

Source: https://habr.com/ru/post/1394235/


All Articles