On 08.06.2023 00:46, Vojtěch Čihák via lazarus wrote:
Thanks,
please confirm me if I understand well the concept:
1) when component is put on the form in designer: it is scaled (Width
& Height)
Yes.
2) when it is put on the form later in code: it is not scaled
It depends on what you understand with "it is not scaled".
If you do:
MyComponent.Parent := Panel1;
MyComponent.Width := 100;
MyComponent.Height := 100;
Then obviously the width/height is not scaled because you assigned
constant numbers there.
But the internals are scaled with DoAutoAdjustLayout() if the target PPI
(of Panel1) is different from Screen.PixelsPerInch.
but internals are scaled in both cases (by internals I mean for
example DefaultRowHeight and DefaultColWidth of TStringGrid)
Or at least TStringGrid behaves as I described above.
Yes.
Because I need to scale internals of TGraphicControl (which has no own
Canvas or Handle) I decided to do scaling in SetParent();.
You definitely should use DoAutoAdjustLayout().
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?
Yes. DoAutoAdjustLayout() takes care of it.
Ondrej
--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus