[DUG] Screen resolution.

John Bird johnkbird at paradise.net.nz
Mon Jul 9 00:42:31 NZST 2012


I had similar issues with Form ScaleBy...

1 - you better only do it once to each form, repeating it makes a mess, 
especially as rounding errors move the components around

2 - String grids and probably DBGrids do not scale properly as the default 
row height and font size do not get scaled.  I write a wrapper call to do 
grids on a form correctly which sets the grid row heights and font sizes.

3 - However neither Scale By nor my wrapper cater well for a form where not 
only the size in pixels is different, but also the DPI, eg 120  which is 
quite common these days.

Mike - I think your code is for different DPI other than 96DPI which is a 
different issue for which I would rather like to hear how others cope. 
Last time I asked about it some years ago when other than 96DPI was rare the 
responses from others here were along the lines "we only cater for 96DPI"

Wallace - I reckon you have to either decide on minimum resolution you can 
support, and don't cater for less than that.   Forms just will give endless 
problems  otherwise.

I set my forms to be OK in that minimum resolution,  eg 1024x768 and use 
scaleby to scale up for larger screens.   That is a safer way to do it both 
for scaleby and using forms that resize to the screen size (below)!

Alternatively you use panels and set the align properties to expand to the 
full screen.  Grids work well then, as they get scroll bars.  This is the 
more traditional way to do it.   Shrinking to fir on a real small screen 
however the grids might shrink to unusably small though eg 1 column wide!

John Bird

-----Original Message----- 
From: Mike Meyer
Sent: Sunday, July 08, 2012 10:50 PM
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Screen resolution.

Hi Wallace,

I place this snippet on all my screens (form create) to assist with
different resolutions.

Seems to work well.  Need to set the scaled property to 'False'.

Assert(not Scaled,
  'TForm.Scaled property sucks, you should set it to False!');
if Screen.PixelsPerInch <> PixelsPerInch then
begin
  ScaleBy(Screen.PixelsPerInch, PixelsPerInch);
end;


Hope this helps

Mike



-----Original Message----- 
From: Marshland Engineering
Sent: Sunday, July 08, 2012 9:21 PM
To: delphi at listserver.123.net.nz
Subject: [DUG] Screen resolution.

After sending a few hours on getting ScaleBy working and the apps automating
re-scaling the form when running on a much lower resolution screen, I then
found it was all futile if  DBGrids are on the form. The forms then end up
any unpredictable size.

Ok my design screen is 1400 x 1050. I made the form a nice 1280 x 1024. When
running on a 1024x600 netbook, the form was something like 820x650 and the
pages wern't good at all.

I tried Perfectsize which works but before the app finally displays
correctly, the main form looks like jelly for a few seconds. Possbly it
redraws the form after each compent conversion and there are a lot of
components to scale.

I tried  EasySize but it crashed and looked for extra pas files that are
nowhere to be found.

I'm not looking to rescale the form as such but be able to show it correctly
on various monitors. However, it appears that correcting the Hubble
telescope mirror may be a bit easier to do. Any suggestions ?

Thanks Wallace


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz with
Subject: unsubscribe

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz with 
Subject: unsubscribe 



More information about the Delphi mailing list