Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

D2: Pixel aspect ratio

Posted on 1997-08-25
3
Medium Priority
?
459 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 200 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

721 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