Forum > Win32/64

Saving Form sizes using Windows DPI aware

(1/4) > >>

VTwin:
I'm trying to debug some appearance issues using the Windows DPI aware settings.

When I hide a Form I save it's width and height, as well as column widths on a DrawGrid. Each time I rerun the application, the sizes are multiplied by a scaling factor, so the Form and column widths increase each time. How can I circumvent this?

A separate question is when I design a form on a Mac and set a Control size to, say, 20, it becomes, say, 30, when I open the project in Windows. This also happens with control spacing in the Anchor Editor, changing my standard 12 to 19. I guess this is by design, but practically it means I need to do all my design on Mac, and switch back and forth when I find bugs.

I'll throw in a third question. Does anyone just not use DPI aware?

I'd appreciate any insight or suggestions.

VTwin:
Maybe I should be saving:

sw := Self.ScaleFormTo96(Self.Width);


EDIT: Answering my own questions. :)

Yes, then restore with:

Self.Width := Self.Scale96ToForm(sw);

wp:
Can you post a simple project which shows the issue?

VTwin:
Thanks wp. Probably.

I'm still trying to nail down what the behavior is on different platforms. I thought I had it figured out on Windows, but now it seems something unexpected is happening on Mac when LCL scaling is on. It looks to me like the Form size (and grid column widths) is rescaled, but not it's position. I figured neither would be. Then I'll have a look at Linux...

The funny thing is that on Mac everything is shrinking, on Windows it was growing! :)

PascalDragon:
I've reported a similar issue with the SQLDBRest demos provided with Lazarus.

Navigation

[0] Message Index

[#] Next page

Go to full version