Inserting a CFormView into a CPropertySheet

In many cases, is usefull to have in one page of propery sheet more controls. But if the area of page is not enough, you have to insert some scroll bars into page. To make this simple you can do the followings:

Creating one CFormView

  • Generate a new dialog with Child style, which contains all controls from one scrollable page on resource
  • From class wizard add a new CFormView, with ID be the id of created dialog. (CMyFormView)
  • Make the constuctor and destructor to be public (by default, these are protected for dynmicaly creation) (CMyFormView)
  • From classwizard, add in this class (CFormView) a new member PostNcDestroy.
  • From the generated body function remove CFormView::PostNcDestroy() ( In CFormView::PostNcDestroy is called delete this)
  • Add handler for WM_CREATE message into CMyFormView, and in the body of the generated function call SetScrollSizes(MM_TEXT, CSize(100,200));
  • Add a new function public: virtual BOOL CMyFormView::Create(CWnd* pParent), with body
    BOOL CMyFormView::Create(CWnd *pParent)
    CRect rect; pParent->GetClientRect(rect);
    return CFormView::Create(NULL, NULL, WS_CHILD | WS_VISIBLE, rect, pParent, 0, NULL);

    Adding the new member of CMyFormView type to one of CPropertyPage

  • From classwizard and in one of pages's sheet, a new member of CMyFormView type.
  • For this page add handler for WM_INITDIALOG message.
  • In the body call, Create(this) of member of CMyFormView type
  • If something is missing or wrong, feel free to ask me at:


    • I have a problem adding a string to a CComboBox in the FormView

      Posted by Legacy on 02/04/2003 12:00am

      Originally posted by: Andrew

      Your article is very useful for me.It was successfull.
      But,when I try to add a string to a CComboBox in the FormView,the application terminated with error message.
      The message is like this

      Debug Assertion Failed

    • I have a problem about TabCtrl and View

      Posted by Legacy on 04/17/2001 12:00am

      Originally posted by: kim

      Your article is very useful for me.
      Actually, I inserted ScrollView into TabCtrl.
      It was successfull.
      But,when I clicked on the ScrollView,the application terminated with error message.
      The message is like this
      Debug Assertion Failed

      I wrote VC++ code just as you did.
      I used ScrollView instead of FormView.

      What is the problem?
      Please advise me!

    • Small Correction

      Posted by Legacy on 02/11/2001 12:00am

      Originally posted by: Vivek Rajan

      Good article -

      In the PostNcDestroy method :-

      Instead of commenting out CFormView::PostNcDestroy,
      you should call CWnd::PostNcDestroy directly.

      ( For more info on PostNcDestroy, see MSDN TN17 )


    • Simple, yet Great... Idea

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

      Originally posted by: Achalla Srinivasu


      the idea is very good and helpful.

      Thank You....

      Srinivasu. A

    • How to make docking pages

      Posted by Legacy on 09/15/1999 12:00am

      Originally posted by: Nemo

      I think your idea is a clue to my problem, but I cannot find the way. I need to implement docking pages like it is done in Delphi environment. I.e. I want to allow pages to be dragged away as floating window and stick back to sheet if they are dragged over it. Can you give me advise?


    • Thanks, exactly what I needed

      Posted by Legacy on 02/15/1999 12:00am

      Originally posted by: chris Rau

      I am new to MFC and was trying to figure out this exact issue when I found your post. Thank you very much. It works like a charm.

    • It's work Ok, but not correctly...

      Posted by Legacy on 02/02/1999 12:00am

      Originally posted by: Aleks

      It's work Ok, but not correctly:

      In ideal, if I navigate to controls using TAB key, focused control
      must begin visiable in property page (i.e. Veiw automatically scrolled
      to focused control position). Next, if I already in this page, I can't
      navigate to other pages and Prop Sheet's buttons, using navigation keys.

      Best way to solve this problem - take original CFormView and CScrollView
      source code, remove all non-needed (on CDocument links and so on), replace
      CView to CWnd, GetParentFrame() to GetParent(),correct some errors and
      add navigation key press and othe messages handling. I hope it's will
      be fine!


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

    Top White Papers and Webcasts

    • Enterprises are increasingly looking to platform as a service (PaaS) to lower their costs and speed their time to market for new applications. Developing, deploying, and managing applications in the cloud eliminates the time and expense of managing a physical infrastructure to support them. PaaS offerings must deliver additional long-term benefits, such as a lower total cost of ownership (TCO), rapid scalability, and ease of integration, all while providing robust security and availability. This report …

    • Anthony Christie, the Chief Marketing Officer for Level Communications, is responsible for customer experience, worldwide marketing and product management. In this informative asset, he shares his insights into why a private network connection to cloud-bases applications is the right decision for your enterprise. Download now to find out more.

    Most Popular Programming Stories

    More for Developers

    RSS Feeds

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