Solved

resolution problem

Posted on 2002-04-06
5
232 Views
Last Modified: 2010-04-04
I do have an application with a large image interface,
and it is distorted ( becomes too large)  when runs in a lower screen-resolution,
any one, or a component  can maintain it ????? ,



RegaRdS.


anaS.
0
Comment
Question by:anas_madani
5 Comments
 
LVL 3

Accepted Solution

by:
tongalite earned 100 total points
ID: 6923555
Hi,

You could check to see which screen res the user has set up and then change it to suit your design screen res mode. Change the scrn res back when your program is exited. A slight problem with this method is that sometimes the icon layout can become disarranged.
Hope this helps
tongalite.

To check/change & restore scrn res do this:
******************************************
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

  implementation

{$R *.DFM}


 function SetScreenResolution( Width, Height: integer): longint;
var
 DeviceMode: TDeviceMode;
begin
 with DeviceMode do begin
    dmSize := SizeOf( TDeviceMode );
    dmPelsWidth := Width;
    dmPelsHeight := Height;
    dmFields := DM_PELSWIDTH or DM_PELSHEIGHT;
 end;
 Result := ChangeDisplaySettings( DeviceMode, CDS_UPDATEREGISTRY );
end;
var
 oldWidth, oldHeight: integer;

procedure TForm1.Button1Click( Sender: TObject );
begin
 oldWidth := GetSystemMetrics( SM_CXSCREEN );
 oldHeight := GetSystemMetrics( SM_CYSCREEN );
 showmessage('You are about to change your Screen Resolution to 800x600');
 SetScreenResolution( 800, 600 );//or your design mode
 form1.position:=poScreenCenter;
 label1.show;
 label2.show;
end;


procedure TForm1.Button2Click(Sender: TObject);
begin
showmessage('This will reset your Screen  Resolution');
SetScreenResolution( oldWidth, oldHeight );
form1.position:=poScreenCenter;
label1.hide;
label2.hide;
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
SetScreenResolution( oldWidth, oldHeight );

end;

end.
0
 
LVL 3

Expert Comment

by:tongalite
ID: 6923559
Oops... I left a couple of labels in that code.
edit those out.
:-)
t.
0
 
LVL 3

Assisted Solution

by:VSF
VSF earned 100 total points
ID: 6923828
tongalite:
This is not a very good practice... changing the resolution without asking! Further more, user's system may not support the res you are trying to set!

anas_madani:
Try this, it worked fine t me and can adjust the app resolution!

procedure TForm1.AdjustResolution(oForm:TForm);
var
iPercentage:integer;
begin
if Screen.Width <> 800 then
  begin
    iPercentage:=Round(((Screen.Width-800)/800)*100)+100;
    oForm.ScaleBy(iPercentage,100);
  end;
end;


Hope it helps!
VSF
www.victory.hpg.com.br
www.boatoda.hpg.com.br
0
 
LVL 1

Expert Comment

by:xsoft
ID: 6961529
listening
0
 
LVL 1

Expert Comment

by:pnh73
ID: 9002936
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between tongalite and VSF

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 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

19 Experts available now in Live!

Get 1:1 Help Now