Ejemplo n.º 1
0
        public static void CheckMouseClickInputCoordinates(MouseKeyFlags buttonDownFlag, MouseKeyFlags buttonUpFlag, int x, int y, int millisecondClickDelay, int numberOfClicks = 1)
        {
            if (x != 0 && y != 0)
            {
                CursorInput.SetCursorPos(x, y);

                for (int i = 0; i < numberOfClicks; i++)
                {
                    AutoMouseEvent.MouseEvent(buttonDownFlag, x, y);
                    AutoMouseEvent.MouseEvent(buttonUpFlag, x, y);

                    Thread.Sleep(millisecondClickDelay);
                }
            }
            else
            {
                for (int i = 0; i < numberOfClicks; i++)
                {
                    AutoMouseEvent.MouseEvent(buttonDownFlag);

                    AutoMouseEvent.MouseEvent(buttonUpFlag);

                    Thread.Sleep(millisecondClickDelay);
                }
            }
        }
Ejemplo n.º 2
0
        // Mouse Wheel
        /// <summary>
        /// Simulates mouse wheel scroll.
        /// </summary>
        /// <param name="amount">Scroll amount (from -120 to 120 - positive is up | negative is down).</param>
        /// <param name="numberOfScrolls">Number of scrolls.</param>
        /// <param name="millisecondDelay">Delay between scrolls.</param>
        public static void MouseWheelScroll(int amount, int numberOfScrolls = 1, int millisecondDelay = 0)
        {
            for (int i = 0; i < numberOfScrolls; i++)
            {
                AutoMouseEvent.MouseEvent(MouseKeyFlags.MOUSEEVENTF_WHEEL, dwData: amount);

                Thread.Sleep(millisecondDelay);
            }
        }
Ejemplo n.º 3
0
        public static void CheckMouseInputCoordinates(MouseKeyFlags buttonFlag, int x, int y, int millisecondClickDelay)
        {
            if (x != 0 && y != 0)
            {
                CursorInput.SetCursorPos(x, y);

                AutoMouseEvent.MouseEvent(buttonFlag, x, y);

                Thread.Sleep(millisecondClickDelay);
            }
            else
            {
                AutoMouseEvent.MouseEvent(buttonFlag);

                Thread.Sleep(millisecondClickDelay);
            }
        }