SetCursorPos() приватный Метод

private SetCursorPos ( int X, int Y ) : bool
X int
Y int
Результат bool
Пример #1
0
        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);
        }
Пример #2
0
 public static void SetCursorPos(IntPoint point)
 {
     NativeMethods.SetCursorPos(point.X, point.Y);
 }