BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DrawIcon into TPaintBox draws ugly

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Michael Fritz
Guest





PostPosted: Mon Nov 22, 2004 3:40 pm    Post subject: DrawIcon into TPaintBox draws ugly Reply with quote



Hi,

I'm using DrawIcon to draw an icon from a resource file onto a TPaintBox.
The resource file or better the icon has got a 48 x 48 icon with a color
depth of 256 colors.

The paint box is of 48 x 48 - exactly like the icon I want to paint.
However the drawn icon seems to be smaller and looks like DrawIcon() had
resized it.

Is DrawIcon capable of doing this? If so how do I prevent this function to
not behave like this?

Thx,

--
cu,
Michael
Back to top
Peter Below (TeamB)
Guest





PostPosted: Mon Nov 22, 2004 7:13 pm    Post subject: Re: DrawIcon into TPaintBox draws ugly Reply with quote



In article <s8gfz8uel1zh.dlg (AT) die-fritzens (DOT) de>, Michael Fritz wrote:
Quote:
I'm using DrawIcon to draw an icon from a resource file onto a TPaintBox.
The resource file or better the icon has got a 48 x 48 icon with a color
depth of 256 colors.

The paint box is of 48 x 48 - exactly like the icon I want to paint.
However the drawn icon seems to be smaller and looks like DrawIcon() had
resized it.

Is DrawIcon capable of doing this? If so how do I prevent this function to
not behave like this?

Use DrawImage or DrawIconEx instead, it allows you to specify the size you
want. DrawIcon always draws a 32*32 icon.

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Michael Fritz
Guest





PostPosted: Mon Nov 22, 2004 7:40 pm    Post subject: Re: DrawIcon into TPaintBox draws ugly Reply with quote



Am Mon, 22 Nov 2004 20:13:27 +0100 schrieb Peter Below (TeamB):

Quote:
Use DrawImage or DrawIconEx instead, it allows you to specify the size you
want. DrawIcon always draws a 32*32 icon.
Peter,


I tried to locate DrawImage function/procedure. Where did you find it using
e.g. D7?

--
cu,
Michael

Back to top
Michael Fritz
Guest





PostPosted: Tue Nov 23, 2004 10:24 am    Post subject: Re: DrawIcon into TPaintBox draws ugly Reply with quote

"Michael Fritz" wrote in message <news:s8gfz8uel1zh.dlg (AT) die-fritzens (DOT) de>:

Posted an example of result of DrawIcon into b.p.att.
Please take the second posting because the jpg in the first does not work
:-(



--
cu,
Michael
Back to top
Peter Below (TeamB)
Guest





PostPosted: Tue Nov 23, 2004 7:57 pm    Post subject: Re: DrawIcon into TPaintBox draws ugly Reply with quote

In article <10rrimbp57m2f$.dlg (AT) die-fritzens (DOT) de>, Michael Fritz wrote:
Quote:
Use DrawImage or DrawIconEx instead, it allows you to specify the size you
want. DrawIcon always draws a 32*32 icon.
Peter,

I tried to locate DrawImage function/procedure. Where did you find it using
e.g. D7?

Sorry, i misremembered, DrawImage is a GDI+ method. Use DrawIconEx, see
win32.hlp.

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Michael Fritz
Guest





PostPosted: Wed Nov 24, 2004 9:03 am    Post subject: Re: DrawIcon into TPaintBox draws ugly Reply with quote

"Peter Below (TeamB)" wrote in message
<news:VA.0000b53f.008a5923 (AT) nomail (DOT) please>:

Quote:
Sorry, i misremembered, DrawImage is a GDI+ method. Use DrawIconEx, see
win32.hlp.
Thanks Peter, however this does not help either. Did you have a look at my

next posting dealing with the posting I've sendt to b.p.att.?


--
cu,
Michael

Back to top
Peter Below (TeamB)
Guest





PostPosted: Wed Nov 24, 2004 6:36 pm    Post subject: Re: DrawIcon into TPaintBox draws ugly Reply with quote

In article <zrhtsnf3f3kn$.dlg (AT) die-fritzens (DOT) de>, Michael Fritz wrote:
Quote:
Sorry, i misremembered, DrawImage is a GDI+ method. Use DrawIconEx, see
win32.hlp.
Thanks Peter, however this does not help either. Did you have a look at my
next posting dealing with the posting I've sendt to b.p.att.?

No. I'll try to remember to do that tomorrow. I don't have a permanent
online connection, so it's a bit awkward for me to get things out of
b.p.attachments on short notice.


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Michael Fritz
Guest





PostPosted: Thu Nov 25, 2004 10:32 am    Post subject: Re: DrawIcon into TPaintBox draws ugly Reply with quote

"Peter Below (TeamB)" wrote in message
<news:VA.0000b549.004fa868 (AT) nomail (DOT) please>:

Quote:
No. I'll try to remember to do that tomorrow. I don't have a permanent
online connection, so it's a bit awkward for me to get things out of
b.p.attachments on short notice.
Thanks Peter for keeping this in mind anyway!



--
cu,
Michael

Back to top
Peter Below (TeamB)
Guest





PostPosted: Thu Nov 25, 2004 6:39 pm    Post subject: Re: DrawIcon into TPaintBox draws ugly Reply with quote

In article <189f8u9csljss.dlg (AT) die-fritzens (DOT) de>, Michael Fritz wrote:
Quote:
No. I'll try to remember to do that tomorrow. I don't have a permanent
online connection, so it's a bit awkward for me to get things out of
b.p.attachments on short notice.
Thanks Peter for keeping this in mind anyway!

You are using LoadIcon to get the icon from resource. And the SDK docs for
this function have this remark: "LoadIcon can only load an icon whose size
conforms to the SM_CXICON and SM_CYICON system metric values. Use the
LoadImage function to load icons of other sizes."

This limitation of LoadIcon is the source of your trouble. So do as MS
suggests and use LoadImage instead.


Quote:


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Michael Fritz
Guest





PostPosted: Thu Nov 25, 2004 7:36 pm    Post subject: Re: DrawIcon into TPaintBox draws ugly Reply with quote

Am Thu, 25 Nov 2004 19:39:04 +0100 schrieb Peter Below (TeamB):

Quote:
You are using LoadIcon to get the icon from resource. And the SDK docs for
this function have this remark: "LoadIcon can only load an icon whose size
conforms to the SM_CXICON and SM_CYICON system metric values. Use the
LoadImage function to load icons of other sizes."

This limitation of LoadIcon is the source of your trouble. So do as MS
suggests and use LoadImage instead.
Oh I never guessed that LoadIcon is the cause of this problem- THANKS!




--
cu,
Michael

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.