<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 08.06.2023 00:46, Vojtěch Čihák via
lazarus wrote:<br>
</div>
<blockquote type="cite" cite="mid:20230608004647.AF1D5A9E@atlas.cz">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p style="padding:0 0 0 0; margin:0 0 0 0;">Thanks,</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">please confirm me if I
understand well the concept:</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">1) <span
style="font-size: 10pt;">when component is put on the form in
designer: it </span><span style="font-size: 10pt;">is scaled
(Width & Height) <br>
</span></p>
</blockquote>
<p>Yes.</p>
<blockquote type="cite" cite="mid:20230608004647.AF1D5A9E@atlas.cz">
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span
style="font-size: 10pt;">2) when </span><span
style="font-size: 10pt;">it is put on the form later in code:
it is not scaled <br>
</span></p>
</blockquote>
<p>It depends on what you understand with "it is not scaled".</p>
<p>If you do:</p>
<p>MyComponent.Parent := Panel1;<br>
MyComponent.Width := 100;<br>
MyComponent.Height := 100;<br>
<br>
Then obviously the width/height is not scaled because you assigned
constant numbers there.</p>
<p>But the internals are scaled with DoAutoAdjustLayout() if the
target PPI (of Panel1) is different from Screen.PixelsPerInch.</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:20230608004647.AF1D5A9E@atlas.cz">
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span
style="font-size: 10pt;">but internals are scaled in both
cases (by internals I mean for example DefaultRowHeight and
DefaultColWidth of TStringGrid)</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span
style="font-size: 10pt;">Or at least TStringGrid behaves as I
described above.</span></p>
</blockquote>
<p>Yes.</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:20230608004647.AF1D5A9E@atlas.cz">
<p style="padding:0 0 0 0; margin:0 0 0 0;">Because I need to
scale internals of TGraphicControl (which has no own Canvas or
Handle) I decided to do scaling in SetParent();.</p>
</blockquote>
<p>You definitely should use DoAutoAdjustLayout().</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:20230608004647.AF1D5A9E@atlas.cz">
<p style="padding:0 0 0 0; margin:0 0 0 0;">For curiosity: was
tested the case when someone has two or more monitors with
different DPI and moves the form (made in Lazarus) from one
monitor to another?</p>
</blockquote>
<p>Yes. DoAutoAdjustLayout() takes care of it.<br>
</p>
<p>Ondrej<br>
</p>
</body>
</html>