MFC Feature Pack Tutorial – Part 2 – CMFCPropertySheet

New MFC feature pack property sheet is indeed cool. It’s named as CMFCPropertySheet. We’ve got to work with it as we used to work with CPropertySheet i.e. derive our own class and add pages (CMFCPropertyPage) to it. It’s parent class is as expected, CPropertySheet.

With just one call to CMFCPropertySheet::SetLook member function we can change it’s look and feel. Different looks supported by CMFCPropertySheet is as follows ( its an enum called PropSheetLook)…

  1. PropSheetLook_Tabs
  2. PropSheetLook_OutlookBar
  3. PropSheetLook_Tree
  4. PropSheetLook_OneNoteTabs
  5. PropSheetLook_List

So to change look and feel of our new property sheet we have to call SetLook likewise

  1. SetLook( CMFCPropertySheet::PropSheetLook_OneNoteTabs ); // One note look and feel
  2. SetLook( CMFCPropertySheet::PropSheetLook_OutlookBar ); // Outlook pane look and feel
  3. etc

Ideal place to invoke this call is the constructor of our CMFCPropertySheet derived class. It’s a rule that SetLook should be called just before DoModal or Create.

So that was the tabs part try them out, so how is this done, right? There are dedicated classes for managing these look and feel stuff in a property sheet. If you look up CMFCPropertySheet header you will see the following members…

  • CMFCOutlookBarPaneList m_wndPane1;
  • CMFCPropertySheetTabCtrl m_wndTab;
  • CMFCProperySheetListBox m_wndList;
  • CMFCOutlookBar m_wndOutlookBar; // For outlook
  • CTreeCtrl m_wndTree;

So rest is just coding for switching among tabs. Lets now come to the tab icon part, how to set tab icons, it’s just very easy, call SetIconsList, we don’t even need a bitmap object, just resource id of a bitmap strip along with size of each bitmap. So if we have a bitmap strip called IDB_NIBU πŸ˜‰ and each bitmap in this strip is 32 pixels wide and high, then call SetIconsList likewise to set tab icons in the constructor of our CMFCPropertySheet derived class…

SetIconsList( IDB_NIBU, 32); // Now we should start seeing our icons

Now, it’s about adding pages, pages for new CMFCPropertySheet should be of type CMFCPropertyPage, here we add two pages to our property sheet.

AddPage(&m_Page1);
AddPage(&m_Page2);

So after all this work how does our new property page look, show us a screenshot man! πŸ˜€ Ok ok stop crying here is it… πŸ˜›

1. One note style

One note style property sheet tabs

2. Outlook style

Outlook style property sheet

9 thoughts on “MFC Feature Pack Tutorial – Part 2 – CMFCPropertySheet

  1. How do I create something an app that looks like the screen shots? Is there any codes that I can refer to?

  2. How to create dialog box with property sheet look but without tabs,tree etc..

    I need to create simple dialog box with MFC feature pack look

    Thanks
    Sandeep

  3. But… Is it possible to skin a dialog or a property page???
    I’d like it to have office-style look… Or should they always have system style?

    thanks

  4. When CMFCPropertySheet::PropSheetLook_List option is used , scroll bars are not displayed

    ———————————————————————————————————————-

    According to MSDN :

    For PropSheetLook_List

    The framework displays scroll arrows if there are more list items than will fit in the visible area of the list.

    Unfortunately, scroll bars are not displayed when there are many items presents outside visible area.

Appreciate your comments...