我可以移動鼠標爲:
[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