Resizable CPropertySheet


How to Help Your Business Become an AI Early Adopter

I recently needed a wizard that could be resized by the user. After looking around on CodeGuru I found nothing that would do this completely so I created my own (since I have taken so much code and ideas from CodeGuru, I felt that the time had come to give something back).

After a while I came up with the class CResizablePropertySheet. It is derived from the MFC CPropertySheet class and handles the resizing of the standard wizard buttons, the tab control and the pages included in the sheet. The CResizablePropertySheet uses a class CDlgItemResizer that handles the resizing of the controls in the property sheet. In an article written by Eli Vingot ( implementing a resizable dialog, I found some great code. I have been writing control-resizing code manually for almost 10 years and the idea just never came to me that this could be automated. Eli Vingot's code really takes the pain out of resizing.

To use the CResizablePropertySheet class, just use it as you would use the MFC CPropertySheet. If you have already derived your own sheet from the CPropertySheet, just replace all occurrences of CPropertySheet to CResizablePropertySheet.

The next thing to do is to handle the resizing in all of the included pages. Create a page the normal way and declare a CDlgItemResizer member variable inside it. Also, add the OnInitDialog() and OnSize() member functions. In the OnInitDialog() function, use the CDlgItemResizer::Add() routine to add all the controls that are to be resized. Make sure to use the correct combination of the resizing flags (lock to top/left/right/bottom). In the OnSize() member function, add a single line of code to resize all controls: call the CDlgItemResizer::Resize().


Download demo project - 20 Kb



  • There are no comments yet. Be the first to comment!

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

Top White Papers and Webcasts

  • How does this impact your content strategy? Content management markets are changing rapidly. Due to increased expectations of users, changes in IT and the need for organizations to rethink their digital strategy, Gartner has launched new Magic Quadrants (MQs) for Content Services Platforms (CSP) and Content Collaboration Platforms (CCP). These MQs have updated the definition of previous Enterprise Content Management (ECM) and Enterprise File Sync and Share (EFSS) markets respectively, and are tightly connected …

  • A leading provider of tools and services to the health care industry was looking to implement automated chargeback reports with aggregation of tiered storage usage across multiple business units and applications. When the company's storage administrators attempted to create this system in-house, their productivity took a huge hit and they discovered the task was too challenging, as well. Read this case study to learn how this company was able to increase storage utilization, reduce storage consumption, and …

Most Popular Programming Stories

More for Developers

RSS Feeds

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