Solved

automaticly fit the system resolution and fonts set

Posted on 1999-01-27
5
217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 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