Solved

resolution problem

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

737 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