There is a hint on this page: https://wiki.freepascal.org/High_DPI#High_DPI_in_Lazarus_1.8_and_above
Hint: Do not develop under HighDPI Mode, always develop under normal mode and only test under HighDPI. Otherwise Lazarus IDE will set DesignTimePPI of the different forms to different values.
.
Easier said than done. I understand the interest of working at 96 PPI (that being that the minimal width of a line would be 1 in 96PPi up scale's acceptably well but down-scaling is going to create 0 width lines if defined as 2 pixel on my 212 PPI screen), but I tell you it si impossible on a 13.3" high resolution screen. A character being displayed with a height of maybe 1 mm, even with a very good sight, that's impossible.
I have looked on Lazarus mailing list and there has been a informative discussion, and a test of PPI conversion that sadly does not compile. I cant figure out how the participants could chat about it without a non compilable program.
Having read that and my recent experience of some patches to lazarus convince me that I'll have to do more testing. It has been hell to reverse my repository to keep 96 PPI dimensions while testing and preparing patches.
Here is a little experiment: I am normally developing on Win-11 at 96ppi and wrote a simple project this way - nothing special, just a few controls, but I checked LCLScaling and selected the "on (True)" DPI scaling setting. This is the default setting, and it is enough to create a scaling application. The form has Scaled=true, and a Width=320 and Height=240 pixels. The attached image "1-..." is taken at runtime (at designtime, it looks the same, of course).
On my Windows system I have a second user which is setup to run at 144 ppi (150%). I switched to this user and ran the application compiled before at 96ppi. Image "2-..." is taken now at 144ppi - everything looks the same, just magnified by the factor 1.5. I started Lazarus which runs at 144 ppi now, and loaded the project - the form looks the same. I added an additional button; it has the size like the other buttons (--> Image "3-...") and compiled.
Returning to my standard user at 96 ppi, I ran the application again which was compiled at 144ppi - the screenshot looks like the first one, just the additonal button (image "4-..."). Loaded the project into the IDE - again no problems.
So, I wonder why people give false statements such as "Do not develop under High-DPI mode"... It is my impression that LCLScaling is rather simple for the application developer: just make the settings mentioned - that's it. Do not attempt to scale anything by yourself.
Scaling is more difficult for the component developer because he has to take care of scaling of the internal dimensions of the component and of the scaling of fonts (except for the standard "Font" property). There has been a recent discussion in the mailing list where Ondrej explained some details (
https://lists.lazarus-ide.org/pipermail/lazarus/2023-June/240437.html).