Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

CDialogEx New Ownerdrawn Dialog Base Class

0.00/5 (No votes)
24 Oct 2001 2  
Custom non-client drawn dialog base derived from CDialog.

Introduction

Using this class you can subclass CDialog. The main reasons for doing this are twofold - to minimize the work done by your MFC dialog-class (like removing silly icon paint on minimized) and thereby decrease your workload and to personalize your dialogs (and to have some fun).

In the example project, notice that you have to link againt msimg32.lib in order to use the ::GradientFill(...) function but you do not have to compile using a redefinition of WINVER and/or _WIN32_WINNT. For details see my slightly modifyed stdafx.h. If you allow redefine WINVER to 0x0500 a better set of constructors are avalible using information for the gradient fill of the active caption on the target OS. Needless to say of course - but using this base class you can have dialogs (or windows with a small modification) in 'private' colors because they paint themselves.

I don't think that there is much more to it. Using the class is in the exact same manner as its base class (plain CDialog) - apart from bigger constructors.

Note that not all event handlers are used. I have implemnted them for future versions.

Good luck.

Ps. And yes I respond to WM_SYSCOLORCHANGE :-).

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here