Solved

Auto resizing forms component

Posted on 1998-08-12
3
241 Views
Last Modified: 2010-04-04
Anybody can provide me with a freeware component that will autosize the forms under different screen resolutions?
0
Comment
Question by:okemoto
3 Comments
 
LVL 4

Expert Comment

by:erajoj
ID: 1361968
Why do you need a component?
In the form's create just add:
  with Screen do SetBounds( 0, 0, Width, Height );

/// John
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1361969
It's really simple to make a thing like this. You get the original screen resolution and your form sizes, and then calculate it this way:

rateX := OldResolutionX/getdevicecaps(GetWindowDC(GetDeskTopWindow), LOGPIXELSX);
rateY := OldResolutionY/getdevicecaps(GetWindowDC(GetDeskTopWindow), LOGPIXELSY);
NewWidth := OldWidth*rateX;
NewHeight := OldHeight*rateY;

-It calculates the proportion of the old resolution and the new. This way you can resize all controls on your form to look the same as in the original screen resolution.
Sorry, but I didn't find a component. I remember that there are such component though, but where are they when you need them?!!
0
 

Accepted Solution

by:
oberdan earned 50 total points
ID: 1361970
Try to scale your form like:

Form1.Width  := Screen.Widht div 2;
Form1.Height := Screen.Height div 2;

(or another size)

and to rescale the components in form use the ScaleBy method. It will resize the components from one proportion like 75% or 50% of form size.

Sorry the bad english.

                              []'s

                                         Oberdan
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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

12 Experts available now in Live!

Get 1:1 Help Now