문제

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