Sizable dialogs at its easiest

Introduction:

Q: What is the difference between the
following two dialogs ?

 small dialogbig dialog

A: There is no difference !

The cdxCSizingDialog class is a class derived from CDialog making it very
easy to implement sizable dialogs. I really missed that feature in VC++ (and IMHO it’s a
shame to the MFC that it doesn’t provide an easy to use way to solve this problem).
However, now it is possible to make your dialogs sizable – you can add this to an existing
dialog in three steps !

In addition to cdxCSizingDialog, you will even find both cdxCSizingPropSheet
and cdxCSizingPropPage in the two files that are part of the zip, but these are
considered to be in beta stadium for now (they seem to work … I only have problems with
the sizing icon).

The most important features of cdxCSizingDialog are:

  • Easy to add even to already existing dialog classes.
  • Several ways controls may react on window size changes, from a simple nothing to
    a percentage-value;
  • Automatic creation of a standard-windows sizing icon (as used by the explorer’s windows)
    in the lower right corner of your dialog.
  • Support to load/store window position to the registry.

Requirements:

  • Tested and used with Visual C++ 5.0.

Files:

  • cdxCSizingDialog.h (header; can be found in the archive)
  • cdxCSizingDialog.cpp (implementation; can be found in the archive)
  • Sample application (includes a documentation; see
    sub-directory "doc" in the archive)

How to use:

    Make your dialog sizable in 3 steps !!

  1. Every control on our dialog needs a DDX value of class control (use Class Wizard
    in the resource editor).
  2. In both the header and implementation file, replace all strings "CDialog"
    by "cdxCSizingDialog" and insert an #include
    "cdxCSizingDialog.h"
    to your header file.
  3. In OnInitDialog(), make a call to AddSzControl() for each control you
    want to resize/reposition if the dialog’s size changes.
  4. Additional features might be used… see the documentation.

    A simple tutorial is included in the documentation that might
    be found here

More by Author

Must Read