這個問題已經過了一個月了,所以也許你已經找到了你自己的解決方案。
在任何情況下,我發現自己在這種情況下爲好,這裏是我的解決方案:
裏面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分開)。