Solved

resolution problem

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

759 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

22 Experts available now in Live!

Get 1:1 Help Now