質問

I'd like to make a c# app that moves the mouse to a specified x,y position on the screen. I've tried a few codes I found online but none seem to work.

役に立ちましたか?

解決

Try this:

System.Windows.Forms.Cursor.Position = new Point { X = xxx, Y = yyy };

Or try to use the native WinAPI for XP (or earlier):

[DllImport("user32.dll")]
public static extern long SetCursorPos(int x, int y);

public void SetCursorPosition(Point p)
{
    SetCursorPos(p.X, p.Y);
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top