Solved

resolution problem

Posted on 2002-04-06
5
241 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

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

735 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