Virtual Developer Workshop: Containerized Development with Docker

This project provides derived MFC classes for painlessly implementing Property Sheets in a CFormViews.  This implementation puts the Property Sheet at the bottom of the view as shown in the following image:

wpe1.jpg (14545 bytes)

Four derived MFC classes are used in this implementation.
  • CPropPgFormView: a CFormView derived class.
  • CPropPgFormDoc: a CDocument derived class.
  • CViewPropertyPage: a CPropertyPage derived class.
  • CViewPropertySheet: a CPropertySheet derived class.

The property sheet is managed by CPropPgFormView, moving the sheet below the template-based controls of the CFormView derived class.  Resizing the frame resizes the Property Sheet accordingly.

What CPropPgFormView gives you:

  • Scrolling sizes are managed for you.
  • Tab order is enabled across the CFormView controls and the Property Sheet.
  • Hotkeys work for the page tabs.
  • Page changing can be disabled.
  • Property page controls can be disabled.
  • Auto-centering of controls within each property page.
  • Adjustable distance between the bottom-most template-based control and the Property Sheet.
  • Form notification of page activation

To use these classes, follow these steps:

  • Base your property pages on CViewPropertyPage instead of CPropertyPage.
  • Base your form view class from CPropPgFormView instead of CFormView.
  • Register the document template with the correct classes in your apps InitInstance():
        CMultiDocTemplate* pDocTemplate;
        pDocTemplate = new CMultiDocTemplate(
    // your CPropPgFormView class
  • Add the property pages in your view's Create() and create the sheet:.
    BOOL CMyFormView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
      DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
    if (!CPropPgFormView::Create(lpszClassName, lpszWindowName,
       dwStyle, rect, pParentWnd, nID, pContext))
    return FALSE;


    // create a modeless property sheet
    if (!m_PropSheet.Create(this)) {
    return FALSE;

    return TRUE;

... and that's it.


Methods and members:

void ResizeForNewControl() - resizes the Property Sheets after programmatically adding new controls
void SetPropertySheetOffset(int iOffset  = PS_Y_OFFSET, BOOL bRedraw  = FALSE) - sets distance between bottom-most form control and top of the Property Sheet
void ResizeParentFrame() - resizes frame window to most efficiently encompass all controls and Property Sheet, and sets scroll sizes
CViewPropertySheet    m_PropSheet - the Property Sheet

BOOL Create(CWnd *pParentWnd, DWORD dwStyle, DWORD dwExStyle) - creates the Property Sheet
void CenterControls(BOOL bCenter /* = TRUE */) - centers the controls on all pages
virtual void AllowPageChange(BOOL bAllowPageChange = TRUE) - allow/disallow changing to a different page

void EnableControls(BOOL bEnable) - enable/disable all controls on a page


In addition, the WM_NOTIFY TCN_SELCHANGE  page change notification message is reflected to the derived CPropPgFormView window.

Please look at the provided project for a better understanding of the implementation details.


Download demo project - 39 Kb


  • Thank you very much, it is very usefull for me to learn MFC

    Posted by buidinhba5 on 08/27/2008 07:26am

    Thank you very much, it is very usefull for me to learn MFC

  • Add ctrls by hand

    Posted by Legacy on 09/23/2003 07:00am

    Originally posted by: Angel Cervantes R.

    Hi, PLEASE!! Can you tell me how can I add controls by hand (with Create function) in the Property Page?

  • Adding large number of records in sorted combobox

    Posted by Legacy on 06/21/2002 07:00am

    Originally posted by: Puneet Jain

    I am finding difficult in initializing the combobox with large number of records and then sorting it.
    Every time, a function is called, its takes a long time to read the records and sort them.
    Is there any way, where after the first use, the process takes a very short time after every reuse.
    I am using VC++ as my application.


  • To change the Look of Property page to Excel sheet type

    Posted by Legacy on 05/06/2002 07:00am

    Originally posted by: shashi

    Hello ,
    I 'm develoing the application with CPropertyPage.as u know the look of property sheet is normal trendy type,i want to change the look of property pages which like Excel sheet type that is all tab at the bottom.
    so can u please any body help me for the above,i dont want to derived from Dialog box i would stricktly like to stik with property page Class and wther there is any way to modify or change in CPro... class.

    Thanks in advance,


  • How to add string to a listbox in one PropPage?

    Posted by Legacy on 08/18/2000 07:00am

    Originally posted by: Jimmy Lee

    If I have a listbox in any one Proppage,
    how can I add a string to that listbox in CMyFormView?

  • Does this really work for SDI application?

    Posted by Legacy on 01/21/2000 08:00am

    Originally posted by: Achalla Srinivasu


    I tried your method for my application, which is SDI based.

    But I am not getting things correct. In particular I don't get WM_SIZE,WM_VSCROLL etc. messages to CPropPageView class at all. However, the PropPageView is getting Created. (OnCreate()).

    I don't understand.... Can you please help?....

    Srinivasu. A

  • Question

    Posted by Legacy on 01/09/2000 08:00am

    Originally posted by: Anne Neuberger

    I am implementing a property sheet as a pop up dialog when the user clicks on a button in a form view. How do I communicate the results of the property sheet to the form view and its document?
    Thank you

  • Tabbing across multiple property sheets?

    Posted by Legacy on 01/06/2000 08:00am

    Originally posted by: Nagesh

    What complexity will it add if we have another property sheet in the form view and we intend to tab across the controls and property sheets? I think it wouldn't work if we just added one more CViewPropertySheet member in the CPropPgFormView.

  • No file to download

    Posted by Legacy on 12/29/1999 08:00am

    Originally posted by: netcoder


    The download link is not working please send me the updated download link


  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date