这个问题已经过了一个月了,所以也许你已经找到了你自己的解决方案。
在任何情况下,我发现自己在这种情况下为好,这里是我的解决方案:
里面MainWindow.xaml,你需要一个KinectRegion内Awesomium控制(从SDK)。
您必须以某种方式告诉SDK,您希望控件也处理手动事件。您可以通过在Window_Loaded处理程序添加这里面MainWindow.xaml.cs做到这一点:
KinectRegion.AddHandPointerMoveHandler(webControl1, OnHandleHandMove);
KinectRegion.AddHandPointerLeaveHandler(webControl1, OnHandleHandLeave);
别处在MainWindow.xaml.cs,您可以定义手处理事件。顺便说一句,我没有这样说:
private void OnHandleHandLeave(object source, HandPointerEventArgs args)
{
// This just moves the cursor to the top left corner of the screen.
// You can handle it differently, but this is just one way.
System.Drawing.Point mousePt = new System.Drawing.Point(0, 0);
System.Windows.Forms.Cursor.Position = mousePt;
}
private void OnHandleHandMove(object source, HandPointerEventArgs args)
{
// The meat of the hand handle method.
HandPointer ptr = args.HandPointer;
Point newPoint = kinectRegion.PointToScreen(ptr.GetPosition(kinectRegion));
clickIfHandIsStable(newPoint); // basically handle a click, not showing code here
changeMouseCursorPosition(newPoint); // this is where you make the hand and mouse positions the same!
}
private void changeMouseCursorPosition(Point newPoint)
{
cursorPoint = newPoint;
System.Drawing.Point mousePt = new System.Drawing.Point((int)cursorPoint.X, (int)cursorPoint.Y);
System.Windows.Forms.Cursor.Position = mousePt;
}
对我来说,棘手的部分是: 1.潜入SDK,并找出要添加的处理程序。文档对此没有太大的帮助。 2.将鼠标光标映射到kinect指针。正如你所看到的,它涉及处理System.Drawing.Point(与另一个库的Point分开)和System.Windows.Forms.Cursor(与另一个库的Cursor分开)。