Board index » delphi » How forms are adjusted for different resolutions

How forms are adjusted for different resolutions

I wrote a program for 800x600 screen resolution. When the program is
run with different screen resolutions form does not fit to screen or
becomes smaller than the original. What can I do to get the same
appearance of forms (including sizes and positions of compenents on
them) with different screen resolutions. I mean I want to scale both
forms and sizes and positions of components on them.
Thanx in advance

AlpDemir

Sent via Deja.com http://www.deja.com/
Before you buy.

 

Re:How forms are adjusted for different resolutions


I had a fun experience with one of these components because I routinely
use a 21" monitor -- but design bitmaps to fit in 800x600 which turns
out to be the most common one in the field.  Well, apparently the
component picked-up on the size of the monitor versus the design-time
size of the bitmap, and the components were actually relocated (as near
as I can tell) in a "screen-wrapping" fashion.  Quite a sight to look
at.

But as Steve says, there are plenty of components out there which can
recognize the actual screen-size and proportionately adjust the position
of the components.  It can still look odd -- you can still get overlap
-- but it's a definite improvement.  I'm surprised that Delphi didn't do
that by default.

Quote
>stevemccus...@pobox.com wrote:

> On Sun, 05 Dec 1999 11:13:01 GMT, a...@mailcity.com wrote:

> >I wrote a program for 800x600 screen resolution. When the program is
> >run with different screen resolutions form does not fit to screen or
> >becomes smaller than the original. What can I do to get the same
> >appearance of forms (including sizes and positions of compenents on
> >them) with different screen resolutions. I mean I want to scale both
> >forms and sizes and positions of components on them.
> >Thanx in advance

> Try ElasticForm from http://www.flash.net/~qsystems/

> Steve McCusker

--
----------------------------------------------------------------------
Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259
mailto:i...@sundialservices.com  (PGP public key available.)
Quote
> High-speed, script-driven, table repair/support for Paradox/BDE...
> ChimneySweep{tm}:  "Click click, it's fixed!" {tm}
> http://www.sundialservices.com/cs3web.htm

Re:How forms are adjusted for different resolutions


Quote
On Sun, 05 Dec 1999 11:13:01 GMT, a...@mailcity.com wrote:
>I wrote a program for 800x600 screen resolution. When the program is
>run with different screen resolutions form does not fit to screen or
>becomes smaller than the original. What can I do to get the same
>appearance of forms (including sizes and positions of compenents on
>them) with different screen resolutions. I mean I want to scale both
>forms and sizes and positions of components on them.
>Thanx in advance

>AlpDemir

>Sent via Deja.com http://www.deja.com/
>Before you buy.

Try ElasticForm from http://www.flash.net/~qsystems/

Steve McCusker

Re:How forms are adjusted for different resolutions


I have had similar problems and one way to at least partially solve this
problem is to set the 'Pitch' property of the main form's font to
fpVariable instead of fpFixed or fpDefault.  All subsequent components you
place on the form (or that are already on the form) should receive this
property as well .. if not you'll need to change it manually or set their
ParentFont proprty to "true"
Hope this helps
-Mike "Fiddler" D.
stevemccus...@pobox.com wrote in <384c6e4b.15873561@Server1>:
Quote
>On Sun, 05 Dec 1999 11:13:01 GMT, a...@mailcity.com wrote:

>>I wrote a program for 800x600 screen resolution. When the program is
>>run with different screen resolutions form does not fit to screen or
>>becomes smaller than the original. What can I do to get the same
>>appearance of forms (including sizes and positions of compenents on
>>them) with different screen resolutions. I mean I want to scale both
>>forms and sizes and positions of components on them.
>>Thanx in advance

>>AlpDemir

>>Sent via Deja.com http://www.deja.com/
>>Before you buy.

>Try ElasticForm from http://www.flash.net/~qsystems/

>Steve McCusker

Re:How forms are adjusted for different resolutions


Hello,

I wrote a little procedure to do the task. I stored it in one unit and
called it from the OnCreate-Event of the form. Write in the
procedure-call a TObject(Self) for the Form to be scaled. Most important
is the used "ScaleBy". You surely can find more information about it in
the Delphi-help.
 If you get problems with some form-fonts you should change the
non-truetypefont of the form to a scaleable TT-font.
Maybe this method is not perfect in any way, but it did, what I wanted.
I hope it can help you too!

Peter Wagner

procedure TForm25.ScaleIt
         (Var AForm: TObject;
              OrigFormWidth,OrigFormHeight,OrigClWidth,OrigClHeight:
Integer);
// The last 4 parameters are only necessary for not maximised windows
// they are used to get the new height and width.
// There seems to be a difference if the Form is a dialog (without Menu)
or an ordinary window with menu.
// With maximised windows use the Height and Width used at design time.
var RandX, RandY: Integer;
begin
  TForm(AForm).Scaled:=true;
  // store original Clientwidth
  TForm(AForm).ClientWidth:=OrigClWidth;
  // store original Clientheight
  TForm(AForm).ClientHeight:=OrigClHeight;
  //TForm(AForm).Width:=OrigFormWidth;
  //TForm(AForm).Height:=OrigFormHeight;
  if Screen.Width<>Form1.ScreenWidthDev // ScreenWidthDev:= ScreenWidth
at design-time!
  then begin
    TForm(AForm).ScaleBy(Screen.Width, Form1.ScreenWidthDev);
    RandX:=TForm(AForm).Width-TForm(AForm).ClientWidth;
    RandY:=TForm(AForm).Height-TForm(AForm).ClientHeight;
    TForm(AForm).Width
      :=TForm(AForm).Width+RandY*Screen.Width div Form1.ScreenWidthDev;
    TForm(AForm).Height
      :=TForm(AForm).Height+RandY*Form1.ScreenWidthDev div Screen.Width;

  end;
end;

a...@mailcity.com schrieb:

Quote
> I wrote a program for 800x600 screen resolution. When the program is
> run with different screen resolutions form does not fit to screen or
> becomes smaller than the original. What can I do to get the same
> appearance of forms (including sizes and positions of compenents on
> them) with different screen resolutions. I mean I want to scale both
> forms and sizes and positions of components on them.
> Thanx in advance

> AlpDemir

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Other Threads