BCGSoft > Developer Area > How to add a Visual Manager support existing dialogs

How to add a 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 to make the following changes in the source code:
  1. Change a parent (base) class name: you’ve to make the following substitutions in both .h and .cpp files:
    • CDialog - CBCGPDialog.
    • CPropertySheet - CBCGPPropertySheet.
    • CPropertyPage - CBCGPPropertyPage.
    • CFormView - CBCGPFormView.
  2. 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).
  3. If some controls on the dialog are already associated with control member variables (such as CButton or CEdit), you’ve 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’ve 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.
For example, if you perform all steps above for the following MFC dialog:
The result will be:

(VS 2017 Blue theme)

(VS 2017 Dark theme)

(Office 2016 Colorful theme)