Board index » delphi » Adjusting Delphi for Screen Resolution, from VB user

Adjusting Delphi for Screen Resolution, from VB user

I'm considering trying Delphi for a new application, after some
experience in VB.  Before purchasing Delphi, I would like to find out
how it handles different screen resolutions?   I've worked on VB
applications using my 800x600 screen resolution, then have to get 3rd
party controls, or write lots of code myself, to get forms and controls
on forms to resize properly if the application is run on a different
screen resolution.  Is this an issue in Delphi?  If so, how is it
typically addressed?  What is the best solution?
Thanks,  Ben Crain, bcr...@gmu.edu
 

Re:Adjusting Delphi for Screen Resolution, from VB user


Quote
>I'm considering trying Delphi for a new application, after some
>experience in VB.  Before purchasing Delphi, I would like to find out
>how it handles different screen resolutions?   I've worked on VB
>applications using my 800x600 screen resolution, then have to get 3rd
>party controls, or write lots of code myself, to get forms and controls
>on forms to resize properly if the application is run on a different
>screen resolution.  Is this an issue in Delphi?  If so, how is it
>typically addressed?  What is the best solution?
>Thanks,  Ben Crain, bcr...@gmu.edu

Hi Ben,

       I'm not a very experienced programmer but as no one else has replied
I'll point out some things I've picked up and found out.

Use only true type fonts on your forms.

Set scaled to true in the forms properties.

        From personal experience I've found that to be absolutely sure that
your app' will look OK on different systems and at different resolutions.
      Set all your components relative to each other. This is a bit of a pain
but I've found it the only way to be certain.
        It appears that Windows/Delphi uses the system font for scaling information as
it's the only thing that is 'fixed'. If someone uses 1600 * 1152 and small
fonts, this can mean your app' looks really tiny, so bear it in mind. I don't
actually have a way round this at the moment but I suppose if someone is
accustomed to using kit at these settings, then that's the way they like it!!
It wouldn't be unreasonable for a graphics person to be using settings like
this and still want to use a WP. At these settings you'd have to have eyes like
the proverbial to use a WP. I'd be very appreciative if anyone can suggest ways
round this myself.

      If your form needs resizing at run time and you've used GetMinMax(var
MinMaxMessage: TWMGetMinMaxInfo); to fix the min and max sizes you may find
some odd results if someone uses 1600 * 1152 res. Set the min/max as a fraction
of the screen size in pixels to get round this if it doesn't cause problems.

That's about all I can think of right now.

Hope it helps

Gordon Whittam.
Nice little endearment from Mrs. GWhit41980: "I'm sick of looking at the back
of your bald head with you staring into a screen"   Post Delphi3!!

Re:Adjusting Delphi for Screen Resolution, from VB user


Quote
>I'm considering trying Delphi for a new application, after some
>experience in VB.  Before purchasing Delphi, I would like to find out
>how it handles different screen resolutions?   I've worked on VB
>applications using my 800x600 screen resolution, then have to get 3rd
>party controls, or write lots of code myself, to get forms and controls
>on forms to resize properly if the application is run on a different
>screen resolution.  Is this an issue in Delphi?  If so, how is it
>typically addressed?  What is the best solution?
>Thanks,  Ben Crain, bcr...@gmu.edu

Delphi has a bit more of what you'd call "geometry management" than VB has.  
In Delphi 3 and up, the Align property helps a lot.  You can Align things to
alLeft or alRight (which leaves the width alone as the form resizes, but
adjusts the height as high as it can), alTop or alBottom (leaves the height
alone, but adjusts the width as wide as it can), or alClient (takes up as much
room as it can).  With clever use of TPanel components (which you can align to
one another, then stick controls inside), you can develop some pretty nicely
resizable apps.

You can also check out the Screen object for Screen.Height and Screen.Width,
if you want to know your resolution.

In Delphi 4, there are also Anchors and Constraints.  Anchors let you specify
which sides to "stick to" as the form resizes, so if you choose to anchor it
to the right, it will scoot along with the right hand side as you resize.  If
you anchor it to the right and bottom, it will scoot along with the lower
right corner, and if you anchor it to the top, right and bottom, it will keep
its top, bottom and right edges the same distance away from the sides of the
form (which will make it stretch and shrink vertically if you resize the form
vertically).  The Constraints let you specify the maximum and minimum
rectangular bounds a control should ever have.  It's quite the
self-adjust-fest when you use all of the features :)

As for other concerns, use a TrueType font, be careful of the Scaled property
(turn it off if you've got very precise placement of your controls, but if you
use a lot of geometry management, it's probably better on), and just remember
that people who use really high resolutions on-screen typically do so because
they want to get MORE things on the screen at once.   Having a
sparsely-populated form pop up and fill the entirety of a 1600 x 1200 screen
on a 21" monitor... is *heinously* annoying :)  (But a 3D/CAD package, on the
other hand, the extra detail is most welcome :)

Hope that quenches your query :)

  --=- Ritchie Annand

Re:Adjusting Delphi for Screen Resolution, from VB user


here is the code
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;

Quote
GWhit41980 wrote in message

<1998082511410901.HAA22...@ladder03.news.aol.com>...
:>I'm considering trying Delphi for a new application, after
some
:>experience in VB.  Before purchasing Delphi, I would like
to find out
:>how it handles different screen resolutions?   I've worked
on VB
:>applications using my 800x600 screen resolution, then have
to get 3rd
:>party controls, or write lots of code myself, to get forms
and controls
:>on forms to resize properly if the application is run on a
different
:>screen resolution.  Is this an issue in Delphi?  If so,
how is it
:>typically addressed?  What is the best solution?
:>Thanks,  Ben Crain, bcr...@gmu.edu
:
:Hi Ben,
:
:       I'm not a very experienced programmer but as no one
else has replied
:I'll point out some things I've picked up and found out.
:
:Use only true type fonts on your forms.
:
:Set scaled to true in the forms properties.
:
:        From personal experience I've found that to be
absolutely sure that
:your app' will look OK on different systems and at
different resolutions.
:      Set all your components relative to each other. This
is a bit of a pain
:but I've found it the only way to be certain.
: It appears that Windows/Delphi uses the system font for
scaling information as
:it's the only thing that is 'fixed'. If someone uses 1600 *
1152 and small
:fonts, this can mean your app' looks really tiny, so bear
it in mind. I don't
:actually have a way round this at the moment but I suppose
if someone is
:accustomed to using kit at these settings, then that's the
way they like it!!
:It wouldn't be unreasonable for a graphics person to be
using settings like
:this and still want to use a WP. At these settings you'd
have to have eyes like
:the proverbial to use a WP. I'd be very appreciative if
anyone can suggest ways
:round this myself.
:
:      If your form needs resizing at run time and you've
used GetMinMax(var
:MinMaxMessage: TWMGetMinMaxInfo); to fix the min and max
sizes you may find
:some odd results if someone uses 1600 * 1152 res. Set the
min/max as a fraction
:of the screen size in pixels to get round this if it
doesn't cause problems.
:
:That's about all I can think of right now.
:
:Hope it helps
:
:Gordon Whittam.
:Nice little endearment from Mrs. GWhit41980: "I'm sick of
looking at the back
:of your bald head with you staring into a screen"   Post
Delphi3!!
:

Re:Adjusting Delphi for Screen Resolution, from VB user


In article <6s3dkf$o3...@mawar.singnet.com.sg>,
  "COSTaFAC" <lance...@mbox2.singnet.com.sg> wrote:

Quote
> here is the code
> implementation
> const
>   ScreenWidth: LongInt = 800; {I designed my form in 800x600
> mode.}
>   ScreenHeight: LongInt = 600;
> <snip>

Interestingly for the application- if it was developed with small fonts as
suggested  then when used on a system with small fonts at other resoultions
(i.e. 1024 *800) it scales correctly.

If used on the same system with the same resolution but using large font
setting then the scaling is incorrect (by the factor between the small and
large fonts).

It would seem that for total correct scaling of forms you would need to
detect the font in use, if small then use the default scaling as detailed in
Inprise TI2861.html but for large fonts an additional overiding scaling
factor would be needed.

Any thoughts ?
Regard - Gordon

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

Re:Adjusting Delphi for Screen Resolution, from VB user


In article <6tkmk6$mk...@nnrp1.dejanews.com>, ghoo...@my-dejanews.com
writes

Quote
>It would seem that for total correct scaling of forms you would need to
>detect the font in use, if small then use the default scaling as detailed in
>Inprise TI2861.html but for large fonts an additional overiding scaling
>factor would be needed.

In my app. I set the form scaled property to FALSE and stick to true
type fonts...this seems to solve small fonts / large fonts problems.

You can also check which font size is in use by reading the value for
pixelsperinch as in:

if PixelsPerInch=120 then LargeFonts:=TRUE etc...

Small fonts is 96, large is 120 pixels per inch BUT I think in Win98 it
may be possible for the user to set other values also

PG

--
Paul Grenet

Other Threads