David Ayre
2008-07-28 15:06:55 UTC
Hi,
I use the following code to scale a form, along with all the
controls on it, to fit the screen:-
float iVScale = ((float)Screen->Height)/((float)Height);
float iHScale = ((float)Screen->Width)/((float)Width);
Top = 0;
Left = 0;
Width = Screen->Width;
Height = Screen->Height;
int iCount = ControlCount;
for(short i = 0;i < iCount;i++)
{
Controls[i]->Left *= iHScale;
Controls[i]->Width *= iHScale;
Controls[i]->Top *= iVScale;
Controls[i]->Height *= iVScale;
}
This works fine except when I have controls in a GroupBox. In
this case it scales the GroupBox but not the controls in it.
Is there any way I can scale the controls inside the GroupBox
as well?
Thanks,
David
I use the following code to scale a form, along with all the
controls on it, to fit the screen:-
float iVScale = ((float)Screen->Height)/((float)Height);
float iHScale = ((float)Screen->Width)/((float)Width);
Top = 0;
Left = 0;
Width = Screen->Width;
Height = Screen->Height;
int iCount = ControlCount;
for(short i = 0;i < iCount;i++)
{
Controls[i]->Left *= iHScale;
Controls[i]->Width *= iHScale;
Controls[i]->Top *= iVScale;
Controls[i]->Height *= iVScale;
}
This works fine except when I have controls in a GroupBox. In
this case it scales the GroupBox but not the controls in it.
Is there any way I can scale the controls inside the GroupBox
as well?
Thanks,
David