Solved

D2: Pixel aspect ratio

Posted on 1997-08-25
3
454 Views
Last Modified: 2010-04-06
How do i obtain the pixel aspect ratio (its physical height vs width in millimeters) in Delphi 2
0
Comment
Question by:gk082597
[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
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1342389
try this, e.g.

const INCHES_PER_MILIMETER : Real  = 0.04;

....

var PixX, PixY : integer;
    PixPerMMX, PixPerMMY : real;
    AspectRatio : real;

PixX := GetDeviceCaps({Device Context}, LOGPIXELSX);
PixY := GetDeviceCaps({Device Context}, LOGPIXELSY);

PixMMX := INCHES_PER_MILIMETER * PixX;
PixMMY := INCHES_PER_MILIMETER  * PixY;

AspectRatio := PixMMY/PixMMX;
....


{Device Context} e.g. Printer.Handle

From Delphi help :

The GetDeviceCaps function retrieves device-specific information about a specified device.

int GetDeviceCaps(

    HDC  hdc,      // device-context handle
    int  nIndex       // index of capability to query  
   );

hdc

Identifies the device context.

nIndex

Specifies the item to return. This parameter can be one of the following values: I recommend you should look at these!!!!

Have fun,
c.u. ZifNab;
0
 

Author Comment

by:gk082597
ID: 1342390
It workt just fine. Thanks
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1342391
Glad I could help.

Have fun,
c.u. BanZif;
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

729 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