The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: starzboy on August 01, 2009, 02:53:16 PM

Title: Icon stretched
Post by: starzboy on August 01, 2009, 02:53:16 PM
I have created a little icon of 16x16, i am then using createwindow to display my icon using SS_ICON OR SS_CENTERIMAGE. The icon shows fine bu it is stretched and the image loks blurred. I adjusted the height and width of the display, now only a portion of the blurred icon is being displayed, how do I fix this ?

code:
invoke    CreateWindowEx,0,chr$("Static"),chr$("Icon"),WS_CHILD Or WS_VISIBLE Or WS_TABSTOP OR SS_ICON OR SS_CENTERIMAGE,445,210,16,16,hWnd,1200,hInstance,0
invoke    SendMessage,eax, STM_SETIMAGE,IMAGE_ICON,dword ptr ds:[hIcon]
Title: Re: Icon stretched
Post by: Ficko on August 01, 2009, 08:48:22 PM
Hi Starzboy,

Your approach is not that realistic.

Usual steps would be:

1.) Load the icon from resource or file with "LoadImage".

2.) Display it with "DrawIcon".

Between 1 and 2 you would also creat a compatibleDC with "CreateCompatibleDC".

Ficko
Title: Re: Icon stretched
Post by: hutch-- on August 02, 2009, 12:51:05 AM
starzboy,

Usually when you create an icon you do multiple resolution versions so each size looks OK. a 16 x 16 for the title bar, a 32 x 32 for a normal desktop icon and bigger if you want it to look OK at a larger size.

Note that a 16 colour icon is reasonably small where the 24 bit with a transparent channel are much larger so if the app size matters, reduce the colour depth.