?
Solved

Display Settings

Posted on 2006-05-21
6
Medium Priority
?
203 Views
Last Modified: 2010-04-05
Hi All

How can I change my program dimensions in accordance to the display settings.
For example if i did my program on 800*600 and later on i install it on 1152*864.

regards

0
Comment
Question by:ibrobar
6 Comments
 
LVL 17

Expert Comment

by:mokule
ID: 16728400
Use Screen.Width and height and change Your forms sizes accordingly.
Play with Align and Anchor properties of controls
0
 
LVL 5

Expert Comment

by:Scay7
ID: 16728863
Well you could write a refresh/detect screen size

procedure getsize(sender : TObject);
  private
  public
  end;

procedure TForm1.getsize(sender : TObject);
begin
scry := screen.height;
scrx := screen.width;

  if scry = 640 then
    if scryx = 480 then
    begin
    //set your forms size correctly here
    end;

  if scry = 800 then
    if scryx = 600 then
    begin
    //set your forms size correctly here
    end;

  if scry = 1024 then
    if scryx = 768 then
    begin
    //set your forms size correctly here
    end;

end;

Or you could use the good suggestion that Mokule made "Align and Anchor properties of controls"

Peace Scay7
0
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 500 total points
ID: 16730381
All you need to do is in your FormCreate() event, put
Form1.ScaleBy(Screen.Width, 1024);  // e.g. if you design in 1024x768, but a client may run in 800x600 or 640x400

From the delphi help:
ScaleBy
Rescales a windowed control and any of its children to a percentage of their former size.

procedure ScaleBy(M, D: Integer);

Description

Call ScaleBy to rescale the control and all its children. ScaleBy modifies the Height and Width properties of the controls, but it does not change the Top and Left properties; therefore, the size of the controls changes, but not the coordinates of the top-left corners of the controls.

The M and D parameters determine the percentage by which the control and its children are scaled. The M parameter is the multiplier and the D parameter is the divisor. For example, to change a control to be 75% of its original size, specify the value of M as 75, and the value of D as 100 (75/100). Alternately, obtain the same results by specifying the value of M as 3, and the value of D as 4 (3/4). Both fractions are equal and result in the control being scaled by the same amount, 75%.

To make the control 33% larger than its previous size, specify the value of M as 133, and the value of D as 100 (133/100). Alternately, specify the value of M as 4, and the value of D as 3 (4/3), as the fraction 133/100 is approximately equal to 4/3.

Note:      Because control sizes and coordinates are integers, scaling them by the M/D ratio incurs some degree of roundoff error. Calling ScaleBy repeatedly may mean that at some point the control disappears (when the roundoff errors make the control smaller). When rescaling controls repeatedly, consider destroying and reloading the form after several rescalings so that the coordinates are rescaled without most of the accumulating roundoff error.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ibrobar
ID: 16769073
Hi it didn't work with me have you tried before

thanks
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 16772423
yes, I use it a lot.
It might be your form's position.
Try setting it to fpDefaultPosOnly
0
 

Author Comment

by:ibrobar
ID: 16804768
Thanks a lot RealLoki , you are great

regards
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

840 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