Board index » delphi » Form.PixelsPerInch is WRONG !!!

Form.PixelsPerInch is WRONG !!!

Hi,

I'm using the PixelsPerInch property of a form to do some scaling, but it
always returns the current Screen.PixelsPerInch value. So: I develop my app
with 'small font' (96 PPI). When I run my exe on a computer with 'large
font' (120 PPI), the Screen.PixelsPerInch is 120, but the
MyForm.PixelsPerInch property is 120 as well, instead of 96!! Why is that
and what to do about it? I am using Delphi 2.

Thanks,

Wim

 

Re:Form.PixelsPerInch is WRONG !!!


El 29 Oct 1997 11:11:37 GMT Wim van Hoorn (cade...@worldonline.nl) escribio:
: Hi,

: I'm using the PixelsPerInch property of a form to do some scaling, but it
: always returns the current Screen.PixelsPerInch value. So: I develop my app
: with 'small font' (96 PPI). When I run my exe on a computer with 'large
: font' (120 PPI), the Screen.PixelsPerInch is 120, but the
: MyForm.PixelsPerInch property is 120 as well, instead of 96!! Why is that
: and what to do about it? I am using Delphi 2.

 why? a good question... maybe the value is set from system on startup, but
 i think this doesn't matter, the question what to do about it is more
 interesting: you can use the value to know your program is being executen
 on a large-font/hi-res screen, and then write a paint handler acording the
 way you want your forms being drawn in those screens. doing this your
 OnPaint/OnResize handler should look like:

  ...
  case myform.pixelsPerInch of
   96: ... {code for painting/resizing at this resolution}
  120: ...
  ...
  end;

  i don't know if it's the best way to do it... but it's simple... :-)

  regards.
--
  Ricardo Mones Lastra - wmas...@aic.uniovi.es
  Centro de Inteligencia Artificial, Universidad de Oviedo en Gijon
  33271 Asturias, SPAIN.
  http://www.aic.uniovi.es/

Other Threads