How to know a Form is resizeable

Class library usage, coding and language questions.
atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

How to know a Form is resizeable

Post by atom » Thu Jul 29, 2010 10:50 am

Hiya

On the Form class there is a method Resize
How to know if a Form is resizeable, so that Resize should work?

Thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to know a Form is resizeable

Post by Support Team » Thu Jul 29, 2010 12:57 pm

Hi,

Sorry but there is no such property or method to check if the window is resizeable, but you can try following method:
private static bool CheckIfResizeable(int x, int y, Ranorex.Form form)
{	
	form.Resize(x,y);
	if(form.ScreenRectangle.Size == new Size(x,y))
	{
		Report.Log(ReportLevel.Info,"Resizeable","True");
		return true;
	}
	else
	{
		Report.Log(ReportLevel.Info,"Resizeable","False");
		return false;
	}
}
But this method depends on the technology of your application.

Regards,
Peter
Ranorex Support team
.
Image

atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

Re: How to know a Form is resizeable

Post by atom » Thu Jul 29, 2010 1:46 pm

ok thanks, the Resize method doesnt throw any exception if it cant resize?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to know a Form is resizeable

Post by Support Team » Thu Jul 29, 2010 2:15 pm

Hi,

Resize throws an exception if the invoking actions fail, but doesn't check if the resize was successfully done.

Regards,
Peter
Ranorex Team
.
Image