[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 652
  • Last Modified:

Large fonts (120 DPI) mess up my screen lay-out

My Application is designed in Normal Size (96 DPI). When it is run under f.e. Large Size(120 DPI) some controls aren't scaled correctly and some fall behind other controls.
How can I make sure my application runs under 96 DPI, can I somehow set this up only within my application?
Please supply me with some sample code.
0
Stef Merlijn
Asked:
Stef Merlijn
  • 3
1 Solution
 
SteveBayCommented:
Have you checked the "Scaled" property?

It's explained well here:
http://www.prestwood.com/aspsuite/kb/document_view.asp?qid=100255
0
 
Stef MerlijnDeveloperAuthor Commented:
I've tried to set scaled to False and PixelsPerInch to 96 in the Oncreate-event of the form, but is still gets resized to the large fonts. Do you have any other ideas?
0
 
diniludCommented:
constructor TForm1.Create(AOwner: TComponent);
begin
   inherited Create(AOwner);
   ParentFont:=False;
   Font.Height:=13;
   PixelsPerInch:=96;
end;
0
 
Stef MerlijnDeveloperAuthor Commented:
Found this solution that works as expected. This code must be added to all forms. The font must be something like Arial (True Font Type).

You must also set:
Form1.Scaled := True
procedure TForm1.FormCreate(Sender: TObject);
begin   
  if Screen.PixelsPerInch <> PixelsPerInch then
  begin     
    ScaleBy(Screen.PixelsPerInch, PixelsPerInch);   
  end; 
end;

Open in new window

0
 
Stef MerlijnDeveloperAuthor Commented:
Thanks for pointing me in the right direction.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now