MFC Feature Pack: CDialogEx Implementation

The beta version of the MFC Feature Pack (the extension to MFC 9 from Visual Studio 2008) contains an extended dialog class implementation, CDialogEx. What this brings new, publicly, is the ability to set the background of the dialog box to a color or an image.

A first new method allows to set a background color.

Dialog box with yellow background.

A second overloaded method allows to set an image on the background.

You can use it like this:

Dialog box with image on the background

What is very weird is that the only styles for the image are these:

This implementation lacks two basic styles: Center and Stretch. I really don’t understand why they were not implemented. It’s much more likely to need an image centered or stretched that aligned at the bottom-left, for instance. Thus, I don’t see how good this class is if I have to override the entire painting myself if I need that functionality.

Here is an implementation of a dialog class that supports those styles.

1 Reply to “MFC Feature Pack: CDialogEx Implementation”

  1. I guess these styles could have received less attention by BCGSoft (who Microsoft licensed these MFC extensions from) because stretched bitmaps looks worse as they quickly become pixelated, and doing it with antaliasing AFAIK requires much more code since it’s not well supported by the GDI.

    For example the bottom left alignment is not as strange as it may sound, since I think a major reason for this class is to provide branding to the dialog boxes. A small logo in an unused corner, for example.

    Plastering the full dialog box with bitmaps is often directly against user interface guidelines.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.