Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how i can detirimne the size of the screen in inch's

Posted on 2001-07-25
14
Medium Priority
?
309 Views
Last Modified: 2010-04-06
i tried to use TScreen property  Heiht (Width) and PixelsPerInch but the results that i get aren't right ...

Plase Help Me !!!

Igor
0
Comment
Question by:igor84
[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
  • 3
  • 3
  • 3
  • +3
14 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 6317124
What results do you get, and what results would be correct?
0
 
LVL 3

Expert Comment

by:Stefaan
ID: 6317341
What are you trying to do ? Determine the screen resolution ? If that is the case, then the follwoing should work :

  ShowMessage(IntToStr(Screen.Width ) +' x '+ IntToStr( Screen.Height));

Best regards,


Stefaan
0
 
LVL 2

Expert Comment

by:bugroger
ID: 6317509
Hi,

Have a look at
 function GetSystemMetrics

"The GetSystemMetrics function retrieves various system metrics and system configuration settings.

System metrics are the dimensions (widths and heights) of Windows display elements. All dimensions retrieved by GetSystemMetrics are in pixels."

ex.:
 ScreenWidth  := GetSystemMetrics(SM_CXSCREEN);
 ScreenHeight := GetSystemMetrics(SM_CYSCREEN);

GL
 Bug



 
0
Industry Leaders: 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!

 
LVL 3

Expert Comment

by:Stefaan
ID: 6317564
Hi,

Sorry didn't notice that you needed the sceen size in inches.  The coude should look like this :

  ShowMessage(FloatToStr(Screen.Width / Screen.PixelsPerInch ) +' x '+ FloatToStr( Screen.Height / Screen.PixelsPerInch ));


But of course bear the following in mind : < snippet from Delphi Help >

PixelsPerInch is only accurate for vertical measurements. Most screens have a different scaling factor for horizontal measurements. The value in PixelsPerInch is set from Windows when Delphi loads.

So the width could be wrong, but the height should be correct.

Best regards,


Stefaan
0
 

Author Comment

by:igor84
ID: 6317599
Sorry but you all are wrong !!!

1. i need my data in inch's.
2. PixelPerInch doesn't realy give the value of how much  
   pixels get into one inch but the size of the font for
   example : small font 96 pixlesPerInch and ect ...

if some one know how to do it then write your answer ...
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6318152
>> Sorry but you all are wrong !!!

How can you say that, when all I was writing was two questions to clarify what you want????

How about answering my questions? Then *maybe* I can help. I'm not even sure yet what exactly you want.
0
 

Author Comment

by:igor84
ID: 6319178
i was talking about two aspects 1. is that i need my data in inch's and not in pixels

and 2 that the use of PixelPerInch isn't used for geting the real amount of pixels per inch.

so don't get mad ...

the results that i get is aobut 13.3" the daginal of the screen when my is 16"

the correct results would be correct acording you screen size measure it and compare it to the results and see if they match
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6319264
Okay, so you want to know whether you have a 15" monitor or a 17" monitor or anything like that? Did I understand that right? That is a real problem. Perhaps Windows knows that in the depth of its registry or perhaps the communication between Windows and the monitor could reveal it. But I fear we normal programmers have no access to those informations. Furthermore a 15" LCD monitor has a bigger "seeable" size than a 15" tube monitor. So I fear what you want is not solvable. At least I don't know how. I'm sorry...   :-(

Regards, Madshi.
0
 
LVL 21

Expert Comment

by:gemarti
ID: 6320080
It seems to me that this is more of a calibration issue. I recall having to place a ruler to my screen and moving a sliding ruler across the screen until 1" on the screen ruler equaled 1" on the ruler I holding to the screen.

So here is my proposal using a factors that are [inches/pixel]. While you try this I have another Idea I am going to work on that may simplify this.

This is all contingent on my understanding your request.  

var
  Result : Variant;
begin

Result :=Screen.Width*0.012451171875;
ShowMessage(VarToStr(Result));

Result := Screen.Height*0.012044270833333333333333333333333;
ShowMessage(VarToStr(Result));

end;
0
 
LVL 21

Accepted Solution

by:
gemarti earned 400 total points
ID: 6320286
You have to measure two points on the screen (This is your calibration). Screens can be curved or flat just as Madshi was saying. I put a ruler to the screen. Held down the right mouse button until I had moved it horizontally 1 inch. I then released it.
OnMouseDown got the starting coordinates.
OnMouseUp got the end coordinates.

If you divide the Screen.Width by the difference of these two numbers you'll get an approximate screen width in inches.

Do the same for the Screen.Height.


\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
procedure TForm1.Button1Click(Sender: TObject);
var
  Result : Variant;
begin
Inch := StrToInt(Label2.Caption) - StrToInt(Label1.Caption);
Label3.Caption := IntToStr(Inch);
Result := Screen.Width/Inch;
ShowMessage(VarToStr(Result));

Result := Screen.Height/Inch;
ShowMessage(VarToStr(Result));

end;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Label1.Caption := IntToStr(Mouse.CursorPos.X);  //Start to Hold Mouse down until you reach an inch
end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Label2.Caption := IntToStr(Mouse.CursorPos.X); //End holding Mouse down at one inch.
end;
0
 

Author Comment

by:igor84
ID: 6323909
this is no solution to me i want to get the data with out measuring something ...

sorry ...
0
 
LVL 21

Expert Comment

by:gemarti
ID: 6323950
You can't get it any other way!

Your'e SOL.


GEM
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8732802
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:

To accept gemarti's comment as answer

Note: There is no way to calculate the real display units without manual intervention. For further reference please see MSDN article Q127152

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

636 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