public static void MouseDrageTo(IMouse mouse, int x, int y, int tx, int ty, ProcessingContext context) { MouseMouseTo(mouse, x, y, context); context.Sleep(100); mouse.PutMouseEvent(0, 0, 0, 0, 1); context.Sleep(100); const int MAX = 20; int dx = tx - x; int dy = ty - y; int signX = dx > 0 ? 1 : -1; int signY = dy > 0 ? 1 : -1; dx = Math.Abs(dx); dy = Math.Abs(dy); while (dx > MAX || dy > MAX) { int mx = dx > MAX ? MAX : dx; dx -= mx; int my = dy > MAX ? MAX : dy; dy -= my; mouse.PutMouseEvent(mx * signX, my * signY, 0, 0, 1); context.Sleep(100); } context.Sleep(800); mouse.PutMouseEvent(dx, dy, 0, 0, 0); context.Sleep(100); }
public static void MouseClick(IMouse mouse, ProcessingContext context) { context.Sleep(100); mouse.PutMouseEvent(0, 0, 0, 0, 1); context.Sleep(200); mouse.PutMouseEvent(0, 0, 0, 0, 0); context.Sleep(100); }
const int YOFF = 0;// 21; public static void MouseMouseTo(IMouse mouse, int x, int y, ProcessingContext context) { y -= YOFF; for (int i = 0; i < 5; i++) { mouse.PutMouseEvent(-200, -200, 0, 0, 0); context.Sleep(100); } const int MAX = 200; while (x > MAX || y > MAX) { int mx = x > MAX ? MAX : x; x -= mx; int my = y > MAX ? MAX : y; y -= my; mouse.PutMouseEvent(mx, my, 0, 0, 0); context.Sleep(100); } mouse.PutMouseEvent(x, y, 0, 0, 0); }
public static void MouseMouseRelative(IMouse mouse, int x, int y) { mouse.PutMouseEvent(x, y, 0, 0, 0); Thread.Sleep(100); }