我可以移动鼠标为:
[DllImport("user32.dll")]
public static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
// move relative from where the cursor is
public static void Move(int xDelta, int yDelta)
{
mouse_event(0x0001, xDelta, yDelta, 0, 0);
}
反正我想平稳地移动鼠标以便用户可以看到它。我想动画它,并采取1秒将其移动到新的位置。结果我要寻找,将作为工作的方法:
public static void Move(int xDelta, int yDelta, int timeInMiliseconds)
{
// i will like to move the mouse to
(mouse.getCurentPos().x+xDelta, mouse.getCurentPos().y+yDelta)
// in timeInMiliseconds miliseconds
}
对不起,我会投票结束。对此感到抱歉 –
其实,其他问题的答案可能会对mouse_event进行多次不必要的调用。查看我的答案编辑。 – SimpleVar