I am currently looking for the best generic solution for screen layout
problems at different screen resolutions.
I have tried the solutions in TI944D, but still have some problems with form
Layout. (labels too big etc)
Has anyone here got a best solution they would like to share? We currently
develop our application at quite high resolutions, and have problems when
deploying to 800x600 or 1024x768. Should a development team be developing at
a common resolution? Is there a magic resolution which ports best across all
resolutions? In the past I had done all my development at 800x600 and a move
to clients with higher resolution seemed to work fine. 

TIA 

Philippe



TI944D follows:
----------------------------

TI944D.txt   Form display with different screen resolutions.
Category   :VCL
Platform    :All
Product    :Delphi  All

Description:
When designing forms, it is sometimes helpful to write the code 
so that the screen and all of its objects are displayed at the 
same size no matter what the screen resolution is.  Here is 
some code to show how that is done:

implementation
const
  ScreenWidth: LongInt = 800; {I designed my form in 800x600 mode.}
  ScreenHeight: LongInt = 600;

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  scaled := true;
  if (screen.width <> ScreenWidth) then
  begin
    height := longint(height) * longint(screen.height) div ScreenHeight;
    width := longint(width) * longint(screen.width) div ScreenWidth;
    scaleBy(screen.width, ScreenWidth);
  end;
end;

Then, you will want to have something that checks to see that 
the font sizes are OK.  You can iterate over each child
control's font to adjust its size as necessary.  This can be
done as follows:

type
  TFooClass = class(TControl); { needed to get at protected }
                               { font property } 

var
  i: integer;
begin
  for i := ControlCount - 1 downto 0 do
    TFooClass(Controls[i]).Font.Size := 
        (NewFormWidth div OldFormWidth) * 
        TFooClass(Controls[i]).Font.Size;
end;

<--Other tips from Borland cut-->



---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to