Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » PNG file format Collapse All
Subject Author Date
himanshu joshi Dec 18, 2006 - 6:08 AM


Is there any way to load a .png file instead of .bmp as we know to load bitmap we use

pNodeRuler->m_iconBig.m_bmpNormal.LoadBMP_Resource(MAKEINTRESOURCE(IDI_GEOMETRY ));

If i have .png file instead of .bmp what is the method to use it in above case
Thanks in advance

Technical Support Dec 18, 2006 - 11:02 AM

There is no API for working with non-bmp images in the CExtBitmap class. But there is a CExtSkinBitmap class in the ProfSkin library, which is based on the CExtBitmap class and includes a set of LoadPNG***()/SavePNG***() methods for working with png images. So you can use this ProfSkin library and load png files using CExtSkinBitmap.

1) Include this into your StdAfx.h file:

#include <Prof-UIS.h>
#include <../ProfSkin/ProfSkin.h>
2) Build the ProfSkin library which uses two third party libraries ZLib and LibPNG.

3) You code may look like as follow:
    CExtSkinBitmap _bmpTmp;
    // Load png from resources:
    LPCTSTR strPngResourceSection = _T("PNG");
    HINSTANCE hInst = ::AfxFindResourceHandle( strPngImageResourceID, strPngResourceSection );
    ASSERT( hInst );
    HRSRC hRsrc = ::FindResourceHandle( hInst, strPngImageResourceID, strPngResourceSection );
    ASSERT( hRsrc );
    VERIFY( _bmpTmp.LoadPNG_Resource( hInst, hRsrc ) );
    pSomeRibbonNode1->m_iconBig = _bmpTmp;
    // Load PNG from file:
    VERIFY( _bmpTmp.LoadPNG_File( _T("C:\Folder\picture.png") ) );
    pSomeRibbonNode2->m_iconBig = _bmpTmp;

himanshu joshi Jan 4, 2007 - 2:22 AM


Thanks for the above .

Just one thing regarding the ID "ID_YOUR_PNG_RESOURCE_IMAGE "
In place of above ID i am passing Id at runtime from different DLL modules for different buttons.
But still i am getting the same image for all the buttons coming from different modules.
What could be done for this ?

Thanks in advance

Technical Support Jan 5, 2007 - 10:48 AM

We can guess the problem hides somewhere in your app. Please check your ID value, that these resources are really resources from the different modules. If this is possible, you can also send us your project so we can check this ourselves.