The main features of the CDibStatic class are:
- The dib can be loaded directly from disk
- Includes palette support
- The image is centered/stretched automatically in the control client area
The palette support is implemented using handlers for the WM_QUERYNEWPALETTE and WM_PALETTECHANGED windows messages, so you have to ensure in your program that the control receives these messages. If the palette never changes the CDib class paints the image with the right palette selected the first time. If the control is used in modal dialogs (fileopen for instance), the palette changes can be due only to other applications, thus realizing palette when gaining focus will always maintain the right colors. You can realize the palette any time you want using the DoRealizePalette member function.
DownloadsDownload demo project - 40 Kb
Download source - 8 Kb