procedure PixelsPerMM(canvas:TCanvas; var x,y:real);
var
h:HDC;
hres,vres,hsiz,vsiz:integer;
begin
h:=canvas.handle;
hres := GetDeviceCaps(h,HORZRES); {display width in pixels}
vres := GetDeviceCaps(h,VERTRES); {display height in pixels}
hsiz := GetDeviceCaps(h,HORZSIZE); {display width in mm}
vsiz := GetDeviceCaps(h,VERTSIZE); {display height in mm}
x := hres/hsiz;
y := vres/vsiz;
end;
you need to pass this thing the canvas for your printer device.
(Conversion from mm to cm left as exercise for the reader <g> )
ns
-----Original Message-----
From: James Sugrue <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Wednesday, 30 August 2000 04:14
Subject: [DUG]: Pixels to cm
>I need to convert pixels to cm, for printed output. Is it safe to assume
>that if I converted the cm figure to inches and multiply by 96 (pixels per
>inch figure) that it will be correct, or is there a better conversion
>function?
>
>Cheers
>
>James
>
>
>
>CAUTION - This message may contain privileged and confidential information
intended only for the
>use of the addressee(s) named above. If you are not the intended recipient
of this message you are
>hereby notified that any use, dissemination, distribution or reproduction
of this message is prohibited.
>If you have received this message in error please notify Progressive
Enterprises Ltd. immediately via
>email at [EMAIL PROTECTED] Any views expressed in this
message are those of the
>individual sender and may not necessarily reflect the views of Progressive
Enterprises Ltd.
>
>This footnote also confirms that Progressive Enterprises Ltd. has swept
this email message for the
>presence of computer viruses. This does not guarantee this message is
virus free.
>
>---------------------------------------------------------------------------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>To UnSub, send email to: [EMAIL PROTECTED]
>with body of "unsubscribe delphi"
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"