Recent

Author Topic: Windows 7 High Dpi Application  (Read 8038 times)

lainz

  • Guest
Windows 7 High Dpi Application
« on: September 09, 2010, 11:25:27 pm »
This is obsolete, please go to this Wiki article:

http://wiki.freepascal.org/High_DPI

Thanks.
« Last Edit: January 23, 2011, 12:52:38 pm by lainz »

mas steindorff

  • Hero Member
  • *****
  • Posts: 533
Re: Windows 7 High Dpi Application
« Reply #1 on: September 10, 2010, 02:31:38 am »
looks good.  I would change the main_form to self so the code can be droped into any form
windows 10 &11, Ubuntu 21+ - fpc 3.0.4, IDE 2.0 general releases

lainz

  • Guest
Re: Windows 7 High Dpi Application
« Reply #2 on: January 10, 2011, 05:20:32 am »
Trankyou, try to download the attached file "scaledpi.zip" this is an unit that helps to scale all components in a form, you only need to call the procedure OnCreate event (see the example inside), is the best way.

const
  FromDPI=96;

procedure TForm1.FormCreate(Sender: TObject);
begin
  if FromDPI <> Screen.PixelsPerInch then begin
    ScaleControl(Self,FromDPI);
  end;
end;
« Last Edit: January 10, 2011, 05:22:34 am by lainz »

 

TinyPortal © 2005-2018