我不能(编程移动鼠标)存取光标的位置 [英] I cannot access Position of the cursor (move mouse programatically)

查看:205
本文介绍了我不能(编程移动鼠标)存取光标的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

    private void MoveCursor(int x, int y)
    {
        // Set the Current cursor, move the cursor's Position,
        // and set its clipping rectangle to the form. 

        System.Windows.Forms.Cursor cursorMouse = new System.Windows.Forms.Cursor(System.Windows.Forms.Cursor.Current.Handle);
        cursorMouse.Position = new System.Drawing.Point(x, y);
        System.Windows.Forms.Cursor.Clip = new System.Drawing.Rectangle(cursorMouse.Position, cursorMouse.Size);
    }

这是我的控制台说:

 Error  11  Member 'System.Windows.Forms.Cursor.Position.get' cannot be accessed with an instance reference; qualify it with a type name instead    F:\Win8\Kinect\InterfaceController\celmaibun\KinectToolbox\KinectToolbox\GesturesViewer\MainWindow.xaml.cs  1314    13  NkGesturesViewer
 Error  12  Member 'System.Windows.Forms.Cursor.Position.get' cannot be accessed with an instance reference; qualify it with a type name instead    F:\Win8\Kinect\InterfaceController\celmaibun\KinectToolbox\KinectToolbox\GesturesViewer\MainWindow.xaml.cs  1315    77  NkGesturesViewer

现在,我在C#初学者,我更习惯的Java和Android。一位朋友告诉我它是与实例。但我不知道该怎么做。

Now, I'm a beginner in c#, i'm more used to java and android. A friend told me it has something to do with instances. but i do not know exactly what to do.

推荐答案

我发现了什么问题是,Kinect的不发送的参数从0屏幕以显示宽度,并且它也有一个 - 在右边在主体的左边部分和+,所以不得不做出函数来计算corect点移动鼠标到

I found out what the issue was, Kinect does not send the parameters of the screen from 0 to display width, and it also has a - in the left part of the body, and + in the right, so I had to make a function to calculate the corect point to move the mouse to.

这篇关于我不能(编程移动鼠标)存取光标的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆