Skip Navigation LinksBCGSoft > Support > Developer Area > How to add Visual Manager support to existing dialogs

How to add Visual Manager support to existing dialogs

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:

  1. 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.
  2. 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).
  3. 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.
  4. 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:

MFC dialog

The result will be:

BCGControlBar dialog (Visual Studio 2017 blue theme)

(VS 2017 Blue theme)

 BCGControlBar dialog (Visual Studio 2017 dark theme)

(VS 2017 Dark theme)

BCGControlBar dialog (MS Office 2016 colorful theme)

(Office 2016 Colorful theme)

Back to the Developer Area