我想模拟每x秒的鼠标移动。为此,我将使用一个计时器(x秒),当计时器计时时,我将移动鼠标。
但是,如何使用C#移动鼠标光标?
看看Cursor.Position物业。它应该让您开始。
Cursor.Position
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); }