[Lazarus] High-DPI aware LCL ?

Ondrej Pokorny lazarus at kluug.net
Wed Oct 7 12:31:45 CEST 2015


On 07.10.2015 10:25, Michael Van Canneyt wrote:
>
> Would you mind elaborating on this ?
>
> I wrote an app which is DPI aware (as per the instructions on the 
> Lazarus wiki).
>
> It worked on Linux, Windows 7. Then someone ran it on Windows 8 and 
> 10, and those versions of Windows did something which completely 
> messed up the DPI awareness. I believe it has something to do with the 
> manifest, but I didn't have time to investigate it yet :(

I don't use the designer at all (no LFM files). I create every visual 
component and form in pascal sources and I manually care for proper 
scaling. This approach slows down a little bit the design but I have to 
say that I am very happy with it.
Actually everything I do is that I use a scaling factor for every 
control I place on the form. Something like:
Button.Width := ScaleMe(100);
Button.Height := ScaleMe(20);
And yes, I use manifest with DPI awarness enabled.
Easy and works like a charm. I have not added support for multiple 
monitors with different DPI yet, though. But this shouldn't be a big 
problem. You just have to know that the form moved to another screen and 
scale every control appropriately.

Ondrej




More information about the Lazarus mailing list