[DllImport(User)] public extern static void mouse_event(int dwFlags int dx int dy int dwData IntPtr dwExtraInfo)[DllImport(userdll)] static extern bool SetCursorPos(int X int Y)
public enum MouseEventFlags { Move = xLeftDown = xLeftUp = xRightDown = xRightUp = xMiddleDown = xMiddleUp = xWheel = xAbsolute = x } private void button_Click(object sender EventArgs e)
{ SetCursorPos( )//用屏幕取點工具可以得到坐標mouse_event((int)(MouseEventFlagsLeftDown | MouseEventFlagsAbsolute) IntPtrZero)mouse_event((int)(MouseEventFlagsLeftUp | MouseEventFlagsAbsolute) IntPtrZero)}
From:http://tw.wingwit.com/Article/program/net/201311/13947.html