System.Windows.Forms.Cursor を使用せずにマウスの位置を操作する方法はありますか? 相互運用のようなものでしょうか?
これは、System.Windows.Forms を含めることができない特殊な .NET サブセットを使用しているためです。
おっと、質問を読むのが早すぎました。正しい 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);
}