Solved

automaticly fit the system resolution and fonts set

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

734 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