Hi,
I would like to embed some png images as resources of my exe to be later used to populate the imagelists used by toolbars, buttons, etc.
I understand that I cannot use the BITMAP keyword in my resource file but RCDATA insted. But after that I'm lost.
Is it possibile ?
Do you have some code to share that can explain how to do it ?
Regards Giuseppe
png images
- orangesocks
- Mensajes: 59
- Registrado: Jue May 05, 2011 3:28 pm
Re: png images
Hi Giuseppe,
just add the image to the resource manager, as it were a bitmap. Xailer does the rest.
BTW, in the .rc file it's used the keyword PNG. I.e.:
MyImage PNG "MiImage.png"
just add the image to the resource manager, as it were a bitmap. Xailer does the rest.
BTW, in the .rc file it's used the keyword PNG. I.e.:
MyImage PNG "MiImage.png"
- orangesocks
- Mensajes: 59
- Registrado: Jue May 05, 2011 3:28 pm
Re: png images
Hi Jose,
thanks. Xailer truly is amazing
Regards Giuseppe
thanks. Xailer truly is amazing
Regards Giuseppe
- orangesocks
- Mensajes: 59
- Registrado: Jue May 05, 2011 3:28 pm
Re: png images
Hi Jose,
I tried your suggestion and the resources are added to the .exe but when I try to load them into an imagelist I got an error.
Here is the code I'm using to load the imagelist which works fine with BMP resources.
FUNCTION xtImageListLoad( poParent, pcaResource, pnSize )
LOCAL uElem AS USUAL
LOCAL oImgList AS OBJECT
WITH OBJECT oImgList := TImageList():New( poParent, pnSize, pnSize )
:Create()
IF ( HB_IsString( pcaResource ) )
//---------------------------------------------------------------------
// Load resource
//---------------------------------------------------------------------
:Add( pcaResource )
ELSEIF ( htIsArrayOfStrings( pcaResource ) )
//---------------------------------------------------------------------
// Load array of resources
//---------------------------------------------------------------------
FOR EACH uElem IN pcaResource
:Add( uElem )
NEXT
ENDIF
END
RETURN oImgList
Attached the screenshot of the output window of the debugger.
Thanks for you help. Regards Giuseppe
I tried your suggestion and the resources are added to the .exe but when I try to load them into an imagelist I got an error.
Here is the code I'm using to load the imagelist which works fine with BMP resources.
FUNCTION xtImageListLoad( poParent, pcaResource, pnSize )
LOCAL uElem AS USUAL
LOCAL oImgList AS OBJECT
WITH OBJECT oImgList := TImageList():New( poParent, pnSize, pnSize )
:Create()
IF ( HB_IsString( pcaResource ) )
//---------------------------------------------------------------------
// Load resource
//---------------------------------------------------------------------
:Add( pcaResource )
ELSEIF ( htIsArrayOfStrings( pcaResource ) )
//---------------------------------------------------------------------
// Load array of resources
//---------------------------------------------------------------------
FOR EACH uElem IN pcaResource
:Add( uElem )
NEXT
ENDIF
END
RETURN oImgList
Attached the screenshot of the output window of the debugger.
Thanks for you help. Regards Giuseppe
- Adjuntos
-
- screenshot.215.jpg (48.66 KiB) Visto 18975 veces