Solved

automaticly fit the system resolution and fonts set

Posted on 1999-01-27
5
210 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 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

14 Experts available now in Live!

Get 1:1 Help Now