I didn't find a way to resize an application window in Ranorex 2.1. I found a way to move a window (MoveTo), but there's no way to resize it.
Class Element contains Size and ScreenRectangle, but those cannot be set. Nor there is any action or attribute to modify the size.
Thanks for any suggestions.
Resizing application window
Do you need more than the .Maximize, .Minimize & .Restore methods?
Maybe you can try getting the location & size of the form then doing a click down, mouse move & click up to stretch the form yourself?
Maybe you can try getting the location & size of the form then doing a click down, mouse move & click up to stretch the form yourself?
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Resizing application window
I need to be able to resize the window so that components within it are resized too (to a specific size so I can take and compare a screenshot of them).
Your suggestion is an ugly hack which I'd like to avoid.
Thanks
Your suggestion is an ugly hack which I'd like to avoid.
Thanks
- Support Team
- Site Admin
- Posts: 12174
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Resizing application window
If your window is a .NET Windows Forms control, you can in fact set its Size and Location using the Control.SetPropertyValue method:
Regards,
Alex
Ranorex Support Team
Ranorex.Unknown myWindow = "..."; Ranorex.Control myControl = myWindow.As<Control>(); myControl.SetPropertyValue("Size", new Size(300, 200));However, in general I recommend the method Ciege mentioned since it is more similar to the actions a human user would perform. There are methods to set the size/location of windows directly, e.g. via the Windows API, but these methods bypass the standard user actions and are not guaranteed to have the same effect (e.g. if you'd set the size of a .NET Windows Forms Form through Windows API messages, the SizeChanged event in the form might not be raised resulting in undefined behaviour of your application).
Regards,
Alex
Ranorex Support Team