/// <summary> /// Specify which control or form we should use for the relative position. /// </summary> public void UseOn(ReflectionTester control) { if (mouseControl == null) { Win32.GetCursorPos(out originalPosition); } if (control == null) { throw new ArgumentNullException(nameof(control)); } mouseControl = new MouseControl(control); PositionUnit = GraphicsUnit.Pixel; // Block any user input while we are active. if (!restoreUserInput) { if (!Win32.BlockInput(true)) { //throw new Win32Exception(); } restoreUserInput = true; } }
/// <summary> /// Specify which control or form we should use for the relative position. /// </summary> /// <param name="control"> /// A <see cref="ControlTester"/>. /// </param> public void UseOn(ControlTester control) { if (mouseControl == null) { Win32.Point position; Win32.GetCursorPos(out position); originalPosition = new Point(position.x, position.y); } if (control == null) { throw new ArgumentNullException("control"); } mouseControl = new MouseControl(control); PositionUnit = GraphicsUnit.Pixel; // Block any user input while we are active. if (!restoreUserInput) { if (!Win32.BlockInput(true)) { //TODO Bart De Boeck : Waarom is dit nodig ? Zie ook in Dispose(). //throw new Win32Exception(); } restoreUserInput = true; } }