Board index » delphi » Urgent: PixelsPerInch/Scaled

Urgent: PixelsPerInch/Scaled

Hi,

I've posted in objectpascal as well, but the question here is somewhat
different, so it's NOT crossposting ;-))

OK: I've found out the following. When putting a panel (Height 89 Pixels) on
a form that has PixelsPerInch set to 96 (default on my system) and Scaled :=
True, the panel is scaled correctly when running the program on a test
machine that uses Large Fonts instead of Small Fonts (my machine).

However, when I programmatically set the height of the panel to 35 pixels
and then set the height to 89 pixels again when clicking a button, the panel
is not as high as it would normally have been when not changing its height.

Does that mean that changing the size of a component at runtime doesn't care
about PixelsPerInch? How do I make sure that changing the size on any
machine delivers the same result, i.e. that the ratio is correct?

Currently I solve this by calculating a stretch factor in FormCreate and
when resizing, I multiply the new height with that factor. However, there
must be a more elegant way, right?

Any advice HIGHLY appreciated.
Thanks
Thorsten

 

Re:Urgent: PixelsPerInch/Scaled


Quote
In article <94d6e0$8...@bornews.inprise.com>, Thorsten Dittmar wrote:
> However, when I programmatically set the height of the panel to 35 pixels
> and then set the height to 89 pixels again when clicking a button, the panel
> is not as high as it would normally have been when not changing its height.
> Does that mean that changing the size of a component at runtime doesn't care
> about PixelsPerInch?

Of course, a pixel is a pixel, this is an absolute measure independent of
logical resolution (pixelsperinch). The only thing influenced by the logical
resolution is the height (in pixels) for a font with a given size (in points).
The VCL does the automatic scaling only on form creation. As i said in my
reply to your crossposted message in Objectpascal: don't use a hardcoded
pixels size if your resizes are sensitive to the logical resolution, use a
size relative to the current font.height.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: Till Feb.2001 i will only visit the groups on weekends, so  be patient
if i don't reply immediately.

Other Threads