Click here to Skip to main content
15,896,153 members
Articles / Desktop Programming / MFC
Article

CDialogEx New Ownerdrawn Dialog Base Class

Rate me:
Please Sign up or sign in to vote.
3.00/5 (3 votes)
24 Oct 20011 min read 81.9K   3.2K   20   3
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


Written By
Software Developer (Senior)
Denmark Denmark
c/c++/c# -developer.

Comments and Discussions

 
Questionwhat if menu is present? Pin
Subrahmanyam5-Sep-02 2:36
Subrahmanyam5-Sep-02 2:36 
GeneralCaption gets truncated under WinMe, OK under WinXP Pin
windeveloper25-May-02 23:05
windeveloper25-May-02 23:05 
GeneralUpdated OnNCActivate(...) Pin
26-Oct-01 3:56
suss26-Oct-01 3:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.