Jayakumar Natarajan
Jayakumar Natarajan

Reputation: 113

Mouse move on WPF image control using Kinect

I am trying to move the mouse using the kinect . I achieved using the interopservices in c#. Now i want to move mouse only inside the image control . so mouse should not move on other layouts. Is there any way to achieve the mouse movement without using the interopservices.

Upvotes: 0

Views: 1190

Answers (1)

Nicholas Pappas
Nicholas Pappas

Reputation: 10624

Cursor.Position = new Point()

Will let you move the cursor. You can restrict where in the code too.

Is that what you're looking for, or am I missing something? There really isn't anything specific to the Kinect that I can see.

EDIT:

You can find the tracking function I use in the following post: how to use skeletal joint to act as cursor using bounds (No gestures)

In it, I assign the position of the hand to a "RightHandX" and "RightHandY" parameter. These are basically the mouse position -- you could replace them with a call to Cursor.Position.

If you only want to move the mouse around the image, you can get the bounds of the image and then just add another 'if' statement that does or doesn't send a Cursor.Position based on those bounds and the calculated position of the hand.

Upvotes: 1

Related Questions