If you need to apply a currently selected Visual Manager to one of your existing dialogs (form view or property page), you've to make the following changes in the source code:
- Change a parent (base) class name: you have to make the following substitutions in both .h and .cpp files:
- CDialog -> CBCGPDialog.
- CPropertySheet -> CBCGPPropertySheet.
- CPropertyPage -> CBCGPPropertyPage.
- CFormView -> CBCGPFormView.
- Call EnableVisualManager in the dialog class constructor (in case of the property sheet, it's enough to call this method in CBCGPPropertySheet-derived class constructor only: all pages will be themed automatically).
- If some controls on the dialog are already associated with control member variables (such as CButton or CEdit), you have to replace MFC's class names with corresponding library names (see this article for more details). If control doesn't have the member variable, it will be automatically themed.
- If your dialog contains list box or combo box controls, you have to change their styles to owner-draw + Has strings and add CBCGPListBox/CBCGPComboBox variables for these controls (due to Windows restrictions, the mentioned styles cannot be changed after list box/combo box is created), therefore we cannot make this change. Starting version 32.0 (BCGControlBar Pro only), you may automatically recreate all combo boxes and list boxes by setting a new global flag globalData.m_bAutoPrepareComboListStyles to TRUE in your application class constructor.
For example, if you perform all steps above for the following MFC dialog:
The result will be:
Back to the Developer Area