If you need to apply a currently selected Visual Manager to one of your existing dialogs (form view or property page), you've got 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.
Important! You have to change the parent class everywhere in your code, including the MFC message map. For example, CDialog::OnInitDialog should be replaced
with CBCGPDialog::OnInitDialog.
-
Call EnableVisualManager in the dialog class constructor (in the case of the property sheet, it's enough to call this method in the 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 the list box or combo box is created);
therefore, we cannot make this change. Starting with version 32.0 (BCGControlBar Pro only), you may automatically recreate all combo boxes and list boxes by setting the
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