Which is preferred CTabCtrl vs. CPropertySheet in MFC?

knaser picture knaser · Nov 28, 2008 · Viewed 7.8k times · Source

I don't know how to use both of them. So a sample code with pros and cons is perfect. Which one is preferred? Why?

Answer

Roland Rabien picture Roland Rabien · Nov 28, 2008

Neither is preferred, they serve different purposes. If you want a dialog with several pages, use a CPropertySheet. If you need a dialog with several pages while part of the dialog remains fixed, use a CTabCtrl. A CTabCtrl can be used do everything a CPropertySheet can do, but since the CTabCtrl is more complex to use, it shouldn't be used unless you need its extra flexibility. A CPropertySheet can also be used as a wizard by setting a few flags.

The following is an example of using a CTabCtrl:

aCTabCtrl Example http://rabien.com/image/xcolordialog1.png

If this was a CPropertySheet, then it would not be possible to put the sample colors outside of the tabs. (And the buttons would have to be at the bottom)

Tutorial on CPropertySheet

Tutorial on CTabCtrl