Solved

automaticly fit the system resolution and fonts set

Posted on 1999-01-27
5
211 Views
Last Modified: 2013-12-02
I have made a application on 800*600 system resolution and "Large Fonts",but when I run it on another system resolution
and another Fonts seting,some control is out of The Form.
How do I avoid it?
0
Comment
Question by:annlee
5 Comments
 
LVL 1

Expert Comment

by:Oli2
ID: 1363514
there are different ways.
a tip:
Screen.Width  is the current x resolution ( f.e. 800 )
Screen.Heigth is the current y resolution ( f.e. 600 )
to avoid problems with the large or small fonts, you should define the font of your Form
yourself, so the system font will not be used.

Greetings, Oli
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1363515
The best thing to do, although it limits you a bit, is to design all of your applications with 640X480 as the target resolution using small fonts.  That way you cover all your bases.  The only exception would be if the user was running 640X480 using large fonts - but that is highly unlikely.  I understand Oil2's suggestion, but I personally dont agree with it.  If the user is running say 1024X768 using large fonts, I dont think the he/she would appreciate your app ignoring his system settings.  That is just my opinion though.

Heath
0
 

Expert Comment

by:jdev011599
ID: 1363516
I have tried a scaler component which i got off of some component site.
I believe it was called TScaler :P

Basically, it automatically scales all components on the form. I designed at 800x600 and
it looked okay at both 640 and 1024.I remember some issue with grids, they had a separate component to use with grids.

Caution: I only played with it a bit, I never used it in a professional app.

If you can find one give it a shot.

best regards
jdev
0
 
LVL 10

Accepted Solution

by:
viktornet earned 10 total points
ID: 1363517
jdev, do you think it is a component that I created? I created a component for venks that asked me how to do that.. Here is the source code.... I called it TScaler also that's why i asked you if it is mine,,, I didn;t take much time to write it, but you could try it in a project and if something doesn't work proeprly let me know.. I'll correct it... Just set the constants in the beginning of the code to the resolution you created your app at... It scales the form, all components, and the font also.. Hope this helps...

unit Scaler;

     interface

     uses
       Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
     Dialogs;
     const
        ScreenWidth  : Integer = 800; //If you don't want to declare
constants
                                     //you'd have to have a
        ScreenHeight : Integer = 600;//property for each of these two so
you can
    // declare it at //designtime
     type
       TScaler = class(TComponent)
       private
         FAllScaled : Boolean;
       protected
         { Protected declarations }
       public
         constructor Create(AOwner : TComponent);override;
         procedure Loaded;override;
       published
         { Published declarations }
       end;
     procedure Register;
     implementation
constructor TScaler.Create(AOwner : TComponent);
begin
  Inherited Create(AOwner);
  fAllScaled := False;
end;
procedure TScaler.Loaded;
begin
  Inherited;
  if not(csDesigning in ComponentState) then
    if Owner is TForm then
    with TForm(Owner) do begin
      Font.Pitch := fpVariable;
      if (not

fAllScaled)and((Screen.Width<>ScreenWidth)or(Screen.Height<>ScreenHeight))then
       begin
         Scaled := True;
         AutoScroll := False;
          if Screen.Width < ScreenWidth then
         ScaleBy(Screen.Width, ScreenWidth)
         else ScaleBy(ScreenWidth, Screen.Width);
         fAllScaled := True;
       end;
     end;
end;
procedure Register;
begin
  RegisterComponents('System', [TScaler]);
end;
end.

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1363518
I'm not sure if i did the right math, but you can also use the Height of the screen and scale it by it and not only by the Width,,,
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now