How to Add PNG Image as Button Image in CMFCToolBar?

1.5k views Asked by At

Seems like CMFCToolBar Allowing only BITMAP Images ( which are of color depth 24 ) to place on Buttons. How to get rid of this limitation. i am neither able to place a PNG nor a bit map with color depth 32 (alpha channel included).

i tried attaching my CPngImage to CBitmap but didn't work.

CPngImage image;
image.Load(AfxGetInstanceHandle(), IDB_PNG1);
bitmap.Attach(image.Detach());

so, finally my doubt can we add a PNG/ Bitmap with alpha channel to CMFCToolBar Button as Image?

1

There are 1 answers

0
Roel On

Does this work: Icons on menus of MFC Feature Pack classes ? You'd probably have to adapt it a bit to get it to work in your specific case. I'd suggest staying away from using PNG for toolbar icons etc; you can use AlphaConv (google a bit to find it - it moves around a bit it seems) to convert from png to 32 bit bmp.