Article View: borland.public.cppbuilder.nativeapi
Article #16924Re: Screen unit convert
From: Asger J�rgensen
Date: Mon, 21 Apr 2003 06:56
Date: Mon, 21 Apr 2003 06:56
36 lines
2046 bytes
2046 bytes
Hi Sky
In article <3ea349fc$1@newsgroups.borland.com>, Sky says :
> hi all, I want draw a bitmap on the form,
> Graphics::TBitmap *bmp = new Graphics::TBitmap();
> bmp->LoadFromFile("C:\\temp.bmp");
> bmp->Width = 320; bmp->Height = 240;
> Canvas->Draw(0,0,bmp);
> delete bmp;
You should not set the height and width on a bimap
that contains an image, instead You should use something
like this
TRect Dest = Rect(0, 0, 320, 240);
TRect Src = Rect(0, 0, bmp->Width, bmp->Height);
SetStretchBltMode(Form1->Canvas->Handle, HALFTONE);
SetBrushOrgEx(Form1->Canvas->Handle, 0, 0, 0);
Form1->Canvas->CopyRect(Dest, bmp->Canvas, Src);
> My Question is: Can i convert the size to metric.
> I want set the width of bmp 10cm,
> does anyone can tell me how to do it?
> at the same time i want print it with 10cm on paper.
The only way You can do this is to make the user deside
what is equal to 10 cm, Let them size a for to 10 * 10 cm
and then save that to Your settings.
PixelsPerInch can vary from 96 -> 192 but it is in no
way accurate since the users can choose what ever they
want on their screen.
Best regards
Asger
Technical Details
Message-ID:
<MPG.190db48dd8a4de589896ea@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3ea349fc$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,2dd5cea066b7e2a3 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-04-21 00:03:28 PST From: Asger J�rgensen <Asger.Pnotthis@AJ-World.dk> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Screen unit convert Date: Mon, 21 Apr 2003 08:56:38 +0200 Message-ID: <MPG.190db48dd8a4de589896ea@newsgroups.borland.com> References: <3ea349fc$1@newsgroups.borland.com> Organization: AJ-World X-Newsreader: MicroPlanet Gravity v2.50 NNTP-Posting-Host: 131.164.197.235 X-Trace: newsgroups.borland.com 1050908120 131.164.197.235 (20 Apr 2003 23:55:20 -0700) Lines: 36 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail