设置没有System.Windows.Forms的鼠标位置

有没有一种方法来操纵鼠标的位置,而不使用System.Windows.Forms.Cursor? 像interop可能吗?

原因是我们正在使用一个专门的.NET子集,它不能包含System.Windows.Forms。

哎呀我的坏,读问题太快,继承人正确的PInvoke电话

[DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); 

资料来源: http : //www.pinvoke.net/default.aspx/user32.setcursorpos

 private void MoveCursor() { // Set the Current cursor, move the cursor's Position, // and set its clipping rectangle to the form. this.Cursor = new Cursor(Cursor.Current.Handle); Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50); Cursor.Clip = new Rectangle(this.Location, this.Size); }