模拟鼠标事件

时间:2013-04-23 16:46:18

标签: c# winforms mouse virtual mouseclick-event

我正在尝试使用以下代码模拟鼠标移动:mouse_event(MOUSEEVENTF_MOVE,150 ,150, 0, 0);

它工作正常,但X和Y坐标从我当前的光标位置开始。有没有办法可以让它们从屏幕的左上方开始?

我正在使用c#

在Windows窗体应用中工作

如果你不知道我在问什么,我试着为你画画; enter image description here

1 个答案:

答案 0 :(得分:1)

MSDN文档说您可以简单地set the position of a form's cursor。就这样做,然后发送你的mouseevent。

System.Windows.Forms.Cursor.Position = new Point(0, 0);

然后是你的mouse_event,应该这样做。

相关问题