πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7712

Re: Pixel to inch

#7712
From: Eelke
Date: Tue, 11 Jan 2005 07:46
27 lines
1779 bytes
Bob Gonder wrote:
> Thomas J. wrote:
> 
> 
>>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 
> 
> 
> 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);
> 
Using LOGPIXELSX and LOGPIXELSY you will directly get the DPI value.

You can also use SetMapMode to change the coordinate system.

Eelke
Technical Details
Message-ID: <41e3848e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news2.euro.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41e00c05$1@newsgroups.borland.com> <eqb0u0la4rgijo4jp5ck73ilm55qlojhkp@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7456e13c12db9bc0
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII
Date: Tue, 11 Jan 2005 08:46:36 +0100
From: Eelke <e.klein@mplussoftware.nl>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Pixel to inch
References: <41e00c05$1@newsgroups.borland.com> <eqb0u0la4rgijo4jp5ck73ilm55qlojhkp@4ax.com>
In-Reply-To: <eqb0u0la4rgijo4jp5ck73ilm55qlojhkp@4ax.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 81.58.1.162
Message-ID: <41e3848e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1105429646 81.58.1.162 (10 Jan 2005 23:47:26 -0800)
Lines: 27
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news2.euro.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail