I cannot access Position of the cursor (move mouse programatically)

≡放荡痞女 提交于 2019-12-02 03:09:07

You probably found your answer already or figured out a workaround, but since I had this same issue I thought I'd post what I discovered.

The error popped up for me when I added a reference to System.Windows.Forms.DataVisualization.Charting. It seems that the way the cursor works with that reference is different from usual, and overrides the typical Cursor.Position.

In my case, it was as simple as replacing "Cursor.Position" with "MousePosition".

I suggest you this code

var pc = new PointConverter();
var pt = new Point();
pt = (Point)pc.ConvertFromString(string.Format("{0}, {1}",x,y));
cursorMouse.Position = pt;

link : http://msdn.microsoft.com/en-us/library/system.drawing.pointconverter.aspx

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!