2

My project is about to control the mouse with the new MS Kinect in C# + Kinect SDK. I decided to use a WinForm Project in VS2010. So far, I can move the mouse with my hand and can do some mouseclicks inside and outside my Form. ( So I can control my whole PC with my hands :) ) To control my mouse cursor from a distance, I need to "highlight" it with f.e. a red circle. So I coded some lines and I can draw a red circle around my mouse cursor and it works fine inside that form. But I want to see the same circle on my desktop too.

Here is an Image to show you my problem.

Mouse Problem

The Image shows you, that the second circle is beeing cut, when I leave my mouse outside my Form Window, but it shouldn't !

Any ideas ???

Community
  • 1
  • 1
Sv3n
  • 347
  • 2
  • 6
  • 20

2 Answers2

3

Make a new borderless, transparent, topmost window. Then draw your circle within the window, and periodically pole for the mouse coordinates and recenter the window.

Andrew Hanlon
  • 7,271
  • 4
  • 33
  • 53
  • But wouldn't that borderless window intercept his mouse clicks and prevent the interaction with the desktop? – Brandon Buck Oct 31 '11 at 15:15
  • You can set the window to ignore clicks and pass them through to the window underneath. See e.g. http://stackoverflow.com/questions/318327/transparent-window-or-draw-to-screen-no-mouse-capture/318433#318433 – Joe White Oct 31 '11 at 15:38
  • @JoeWhite Thanks for that, I don't see any issues with this solution. – Brandon Buck Oct 31 '11 at 15:42
  • @ach: I heard something about it, but thought there would be another way. But for now I layered a second Form above (TopMost = true;) and it works fine. Not perfectly, but acceptable. – Sv3n Oct 31 '11 at 17:39
2

Here's something that appears to be a solution to your problem. I haven't tested it, but I will shortly.

Draw directly to screen

EDIT

I have been unable to get the solution to work, if someone else can I'd be happy to see what you've done.

Brandon Buck
  • 7,177
  • 2
  • 30
  • 51