Easy PNG Resource Loading with MFC – Part 2

A previous article demonstrates how easy is to load images from PNG resources, by using Direct2D MFC support. I have found even an easier way: CPngImage class which extends CBitmap with methods that allow loading images from PNG format files and resources.
Here is a brief example:

Using CPngImage class for loading PNG resources

Demo project

It is a simple dialog-based MFC application that loads a bitmap from PNG resource then use the bitmap for setting the image in a static picture control.
Download: PNG Resource Loading (VS 2015).zip (1955)

PNG Resource Loading - Demo Application

PNG Resource Loading – Demo Application


  • of course, we can follow a similar way to set images in other controls, like for example CMFCButton;
  • CPngImage was designed for internal use in the MFC framework, but so far I didn’t see any problem in using it for our own purposes.

Resources and related articles

Leave a Reply