Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pixel to inch

0 views
Skip to first unread message

Thomas J.

unread,
Jan 8, 2005, 11:36:25 AM1/8/05
to
I want to print a bar code but unfortunately the barcode API works with
ínch or millimetre.
How can calculate from pixel to inch or millimetre?

Thanks for your help


Bob Gonder

unread,
Jan 8, 2005, 2:20:20 PM1/8/05
to
Thomas J. wrote:

See GetDeviceCaps()
With the HORZRES and the HORZSIZE (or the Vert versions)

HORZSIZE = page width in mm.
HORZRES = page width in pixels.

mm = GetDeviceCaps( hPrinter,HORZSIZE);
pix = GetDeviceCaps( hPrinter,HORZRES);
pixpermm = pix / mm;
pixperinch = (pix * 254) / (mm*10);

Eelke

unread,
Jan 11, 2005, 2:46:36 AM1/11/05
to
Using LOGPIXELSX and LOGPIXELSY you will directly get the DPI value.

You can also use SetMapMode to change the coordinate system.

Eelke

0 new messages