<div dir="ltr">Wallace it appears that all the procedure is completely self contained, in that it only references passed parameters.<div><br></div><div>Why not just put it in it's own unit (or a common utilities unit) and include it in any form that needs it, rather than having it in the mainform unit</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 11, 2016 at 5:26 PM, Marshland Engineering <span dir="ltr"><<a href="mailto:marshland@marshland.co.nz" target="_blank">marshland@marshland.co.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm back on the window page scaling for various forms in my project. This code<br>
works quite well. It needs to reside in the main form. I can't get the syntax<br>
right to be able to call it from a child form.<br>
<br>
Any suggestions?<br>
<br>
procedure FormScale (rHeiScale:real; rWidScale:real; sForm:tForm);<br>
var<br>
i:integer;<br>
rWidth,rHeight:real;<br>
begin<br>
with sForm do begin<br>
rHeight:=rHeiScale*(Screen.<wbr>Height/Height); // Scale form<br>
rWidth:=rWidScale*(Screen.<wbr>Width/Width);<br>
Height:=Round(Height*rHeight);<br>
Width:=Round(Width*rWidth);<br>
Left:=Round((Screen.Width-<wbr>Width)/2); // Center form<br>
Top:=Round((Screen.Height-<wbr>Height)/2);<br>
for i:=0 to componentcount-1 do<br>
if Components[i] is TControl then begin<br>
TControl(Components[i]).Top :=<br>
Round(TControl(Components[i]).<wbr>Top*rHeight);<br>
TControl(Components[i]).Width :=<br>
Round(TControl(Components[i]).<wbr>Width*rWidth);<br>
TControl(Components[i]).Height :=<br>
Round(TControl(Components[i]).<wbr>Height*rHeight);<br>
TControl(Components[i]).Left :=<br>
Round(TControl(Components[i]).<wbr>Left*rWidth);<br>
end;<br>
end;<br>
end;<br>
<br>
______________________________<wbr>_________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" rel="noreferrer" target="_blank">http://delphi.org.nz/mailman/<wbr>listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.<wbr>net.nz</a> with Subject: unsubscribe<br>
</blockquote></div><br></div>