/// <summary> /// Resizes the window /// </summary> /// <param name="windowHandle">NativeWindowHandle to window</param> /// <param name="width">The new width of the window, in pixels</param> /// <param name="height">The new height of the window, in pixels</param> /// <exception cref="ProdOperationException">Examine inner exception</exception> public static void WindowResize(IntPtr windowHandle, double width, double height) { try { int ret = TransformPatternHelper.Resize(AutomationElement.FromHandle(windowHandle), width, height); if (ret != -1) { return; } double x = AutomationElement.FromHandle(windowHandle).Current.BoundingRectangle.X; double y = AutomationElement.FromHandle(windowHandle).Current.BoundingRectangle.Y; ProdWindowNative.MoveWindowNative(windowHandle, x, y, width, height); } catch (InvalidOperationException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } catch (ArgumentException err) { throw new ProdOperationException(err.Message, err); } }
private static void UiaRotateWindow(ProdWindow baseControl, double degrees) { Collection <object> verboseInformation = new Collection <object> { "degrees = " + degrees }; LogController.ReceiveLogMessage(new LogMessage("Rotated", verboseInformation)); TransformPatternHelper.Rotate(baseControl.UIAElement, degrees); }
private static void UiaMoveWindow(ProdWindow baseControl, double x, double y) { Collection <object> verboseInformation = new Collection <object> { "Y = " + y, "X = " + x }; LogController.ReceiveLogMessage(new LogMessage("move", verboseInformation)); TransformPatternHelper.Move(baseControl.UIAElement, x, y); }
private static void UiaResizeWindow(ProdWindow baseControl, double width, double height) { Collection <object> verboseInformation = new Collection <object> { "Width = " + width, "Height = " + height }; LogController.ReceiveLogMessage(new LogMessage("resize", verboseInformation)); TransformPatternHelper.Resize(baseControl.UIAElement, width, height); }
/// <summary> /// Rotates the window /// </summary> /// <param name="windowHandle">NativeWindowHandle to window</param> /// <param name="degrees">The number of degrees to rotate the element. A positive number rotates clockwise; a negative number rotates counterclockwise</param> /// <exception cref="ProdOperationException">Examine inner exception</exception> public static void WindowRotate(IntPtr windowHandle, double degrees) { try { TransformPatternHelper.Rotate(AutomationElement.FromHandle(windowHandle), degrees); } catch (InvalidOperationException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } catch (ArgumentException err) { throw new ProdOperationException(err.Message, err); } }