[DUG] Procedure run from main program
David O'Brien
Dave at iccs.co.nz
Wed Oct 12 08:56:13 NZDT 2016
How is it defined in the interface?
-----Original Message-----
From: delphi-bounces at listserver.123.net.nz [mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Marshland Engineering
Sent: Tuesday, 11 October 2016 5:27 pm
To: delphi at listserver.123.net.nz
Subject: [DUG] Procedure run from main program
I'm back on the window page scaling for various forms in my project. This code works quite well. It needs to reside in the main form. I can't get the syntax right to be able to call it from a child form.
Any suggestions?
procedure FormScale (rHeiScale:real; rWidScale:real; sForm:tForm); var
i:integer;
rWidth,rHeight:real;
begin
with sForm do begin
rHeight:=rHeiScale*(Screen.Height/Height); // Scale form
rWidth:=rWidScale*(Screen.Width/Width);
Height:=Round(Height*rHeight);
Width:=Round(Width*rWidth);
Left:=Round((Screen.Width-Width)/2); // Center form
Top:=Round((Screen.Height-Height)/2);
for i:=0 to componentcount-1 do
if Components[i] is TControl then begin
TControl(Components[i]).Top := Round(TControl(Components[i]).Top*rHeight);
TControl(Components[i]).Width := Round(TControl(Components[i]).Width*rWidth);
TControl(Components[i]).Height := Round(TControl(Components[i]).Height*rHeight);
TControl(Components[i]).Left := Round(TControl(Components[i]).Left*rWidth);
end;
end;
end;
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz with Subject: unsubscribe
More information about the Delphi
mailing list