[Lazarus] Hi-DPI tweak of components

Ondrej Pokorny lazarus at kluug.net
Wed Jun 7 08:18:36 CEST 2023


On 07.06.2023 00:35, Vojtěch Čihák via lazarus wrote:
>
> I finally built a hi-DPI machine (28'' 4k display, currently set to 
> 118PPI) and I need to tweak EC-Controls 
> (https://wiki.freepascal.org/Eye-Candy_Controls) to scale better.
>
> One problematic is TECSpinBtns because it is designed like this: it 
> consists of (initially) nine small buttons (TPersistent) with 
> hardcoded width=15 and its overall width is 9*15 =135 pixels or N*15 
> in general.
>
> Therefore, when I put this component on the form, its Width is not 
> scaled (Height is). I tried to override DoAutoAdjustLayout but it's 
> not triggered at all.
>
> TECSpinBtns is TGraphicControl.
>
Here is information: 
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/20230607/86213ea8/attachment-0001.htm>


More information about the lazarus mailing list