Archive: [nsdialogs] How to make icon bigger


[nsdialogs] How to display icon in 256x256 size
  Hi,
I want to use in my nsdialogs custom page, few icons.
I choose to display icons, because they are transparent.
So, here is the code I create icon and display it. Unfortunatelly, the size of icon is default, I think 32x32 (but i am not sure, maybe 16x16). The icon I use, has 128x128 size inside... How to force it to use bigger size?



Var /Global My_Icon
File/oname=$PLUGINSDIRMy_Icon.ico "test\\My_Icon.ico"

>; Icon
${NSD_CreateIcon} 15u 40u 100% 100% ""
Pop $My_Icon
${NSD_SetIcon} $My_Icon $PLUGINSDIRMy_Icon.ico $My_Icon_Handle
>...

${
NSD_FreeIcon} $My_Icon_Handle
>
I also tried to add some style, but no success...What am I doing wrong?

    ${NSD_AddStyle} $My_Icon ${SS_REALSIZEIMAGE} 

-Pawel

Anyone have any idea?
-Pawel


After I talked with Anders (thanks) I think I found some solutions. I will paste it here,
maybe someone of you need it too...

So,
To display icon with big size, for example 128x128, I prepared such icon and use this code:

File/oname=$PLUGINSDIRtest.ico "test.ico"  ; Hmm, how to display slash here?

>File /oname=$PLUGINSDIRtest.bmp "test.bmp"
>Var /Global IMAGECTL
>Var /Global IMAGE
>
; Loading transparent icon with big size!

    nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_ICON} 0 120u 0 100% 100% ""

Pop $IMAGECTL
StrCpy$0 $PLUGINSDIRtest.ico
System
::Call 'user32::LoadImage(i 0, t r0, i ${IMAGE_ICON}, i 0, i 0, i ${LR_LOADFROMFILE}) i.s'
Pop $IMAGE
SendMessage $IMAGECTL${STM_SETIMAGE} ${IMAGE_ICON} $IMAGE
>
And, I guess we need to free the resources...

System::Call 'gdi32:DeleteObject(i $IMAGE)' 

We can also use another method. We can use "transparent bitmap". This will display bitmap
with transparent background. Here is an example. You must use 8bpp bitmap.

; Loading Bitmap with transparent background. 8bpp only.
    nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_BITMAP} 0 100u 20u 109u 193u ""

Pop $IMAGECTL
StrCpy$0 $PLUGINSDIRtest.bmp
System::Call 'user32::LoadImage(i 0, t r0, i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_LOADFROMFILE}|${LR_LOADTRANSPARENT}|${LR_LOADMAP3DCOLORS}) i.s'
Pop $IMAGE
SendMessage $IMAGECTL${STM_SETIMAGE} ${IMAGE_BITMAP} $IMAGE

System::Call 'gdi32:DeleteObject(i $IMAGE)'
Try it.
If someone think it could be done another way, please share your knowledge.
-Pawel

You can delete icons of all size except the 128x128 one by software such as Axialis IconWorkshop, try it.


What do you mean "Delete".
The problem is not how to delete icons, but how to display it on NSIS custom page.
-Pawel

Edit: I think I know what you mean. And it seems it work. Thanks.


ive been trying to use the nsdialogs code to load a icon over a background image but the icon doesnt load transparent anyone have any ideas as to why?
code for icon

 nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_ICON} 0 10 0 100% 100% ""

Pop $IMAGECTL
StrCpy$0 $PLUGINSDIRwarn.ico
System::Call 'user32::LoadImage(i 0, t r0, i ${IMAGE_ICON}, i 0, i 0, i ${LR_LOADFROMFILE}) i.s'
Pop $IMAGE
SendMessage $IMAGECTL${STM_SETIMAGE} ${IMAGE_ICON} $IMAGE
>
then later i load the background image before nsDialogs::Show

"" 

>Pop $IMAGECTL

StrCpy$0 $PLUGINSDIRbackground.bmp
System
::Call 'user32::LoadImage(i 0, t r0, i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_LOADFROMFILE}) i.s'
>Pop $IMAGE
SendMessage $IMAGECTL${STM_SETIMAGE} ${IMAGE_BITMAP} $IMAGE
ShowWindow $IMAGECTL${SW_HIDE}
ShowWindow $IMAGECTL ${SW_SHOW}