コード例 #1
0
 // ReSharper disable once UnusedMember.Local
 private void DisableAutorotation()
 {
     User32.BringProcessWindowToFront(_process);
     _mouse.MoveMouseTo((int)(65536.0 * DisableRotationClickX / Screen.PrimaryScreen.Bounds.Width),
                        (int)(65536.0 * DisableRotationClickY / Screen.PrimaryScreen.Bounds.Height));
     _mouse.LeftButtonClick();
 }
コード例 #2
0
            private void PressKey(Keys key)
            {
                User32.BringProcessWindowToFront(_process);
                var code = key;

                _keyboard.KeyDown(code);
                Wait(WaitTimeoutIteration);
                _keyboard.KeyUp(code);
                Wait(WaitTimeoutIteration);
            }
コード例 #3
0
            private void PressKey(Keys key)
            {
                User32.BringProcessWindowToFront(_process);
                var code = (VirtualKeyCode)key;

                _inputSimulator.Keyboard.KeyDown(code);
                Wait(WaitTimeoutIteration);
                _inputSimulator.Keyboard.KeyUp(code);
                Wait(WaitTimeoutIteration);
            }
コード例 #4
0
            private void RotateCam(double x, double y)
            {
                PressKey(Keys.F7);

                User32.BringProcessWindowToFront(_process);
                _mouse.MoveMouseTo(32767 - 32767 * x / Screen.PrimaryScreen.Bounds.Width,
                                   32767 - 32767 * y / Screen.PrimaryScreen.Bounds.Height);
                _mouse.RightButtonDown();
                Wait(WaitTimeoutIteration);

                var lx = 0.0;
                var ly = 0.0;
                var px = 0;
                var py = 0;

                for (var i = 0; i < IterationCount; i++)
                {
                    lx += x / IterationCount;
                    ly += y / IterationCount;

                    var dx = (int)Math.Round(lx) - px;
                    var dy = (int)Math.Round(ly) - py;

                    User32.BringProcessWindowToFront(_process);
                    _mouse.MoveMouseBy(dx, dy);
                    px += dx;
                    py += dy;

                    Wait(WaitTimeoutIteration);
                }

                User32.BringProcessWindowToFront(_process);
                _mouse.RightButtonUp();
                PressKey(Keys.F7);
                Wait(WaitTimeoutEnsure);
            }