private SetCursorPos ( int X, int Y ) : bool | ||
X | int | |
Y | int | |
Результат | bool |
protected override void OnKeyDown(KeyEventArgs e) { switch (e.Key) { case Key.Left: { IntPoint cursorPos = NativeMethods.GetCursorPos(); cursorPos.X -= 1; NativeMethods.SetCursorPos(cursorPos); } e.Handled = true; break; case Key.Right: { IntPoint cursorPos = NativeMethods.GetCursorPos(); cursorPos.X += 1; NativeMethods.SetCursorPos(cursorPos); } e.Handled = true; break; case Key.Up: { IntPoint cursorPos = NativeMethods.GetCursorPos(); cursorPos.Y -= 1; NativeMethods.SetCursorPos(cursorPos); } e.Handled = true; break; case Key.Down: { IntPoint cursorPos = NativeMethods.GetCursorPos(); cursorPos.Y += 1; NativeMethods.SetCursorPos(cursorPos); } e.Handled = true; break; } base.OnKeyDown(e); }
public static void SetCursorPos(IntPoint point) { NativeMethods.SetCursorPos(point.X, point.Y); }