[Lazarus] Hi-DPI tweak of components

Vojtěch Čihák vojtech.cihak at atlas.cz
Thu Jun 8 00:46:47 CEST 2023


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) 
2) when it is put on the form later in code: it is not scaled 
 
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.
 
Because I need to scale internals of TGraphicControl (which has no own Canvas or Handle) I decided to do scaling in SetParent();.
 
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?
 
V.


______________________________________________________________
> Od: "Ondrej Pokorny" <lazarus at kluug.net>
> Komu: "Lazarus mailing list" <lazarus at lists.lazarus-ide.org>, lazarus at lists.lazarus.freepascal.org
> Datum: 07.06.2023 08:19
> Předmět: Re: [Lazarus] Hi-DPI tweak of components
>
On 07.06.2023 00:35, Vojtěch Čihák via lazarus wrote:...
Here is information: https://wiki.freepascal.org/High_DPI#High_DPI_in_Lazarus_1.8_and_above <https://wiki.freepascal.org/High_DPI#High_DPI_in_Lazarus_1.8_and_above>
IIRC, DoAutoAdjustLayout() is executed only when the DPI changes. You have to scale every hardcoded pixel value in the constructor/loading/intitialize as well.
Ondrej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20230608/b6817708/attachment.htm>


More information about the lazarus mailing list