Themes Migration

This document outlines several name changes to the themes for both ActiveX and MFC components.

Most notably the Office 2007 theme has been removed from all enumerations and requires new code to use this theme as well as the new Office 2010 and Windows 7 themes. This document will also outline how to load the new Office 2010 and Windows 7 themes for each control.

In MFC, source defines were added you that you do not need to update the theme names. If you use a Office2007 or Office2010 theme it will automatically use the new resource theme.

Below you will find a list of changes that have been made for this release.

Migration Help (ActiveX Only)

To help aid with your migration to v15.0.1, please download the latest Codejock Grep utility  Grep.zip ( 5.39 Mb ) to easily update your project files with the newly renamed themes, enumerations and other objects listed in the charts below.

After you have downloaded the Codejock Grep utility, download the Migration XML file from the link below to update your project files to use the new Codejock themes, enumerations and object names.

Once you have downloaded the XML file, open the file with notepad or any xml editor to update project path or any of the file filters as needed. The file filters provide a list of file extensions that will be searched and updated.

Once you have done this backup your project first, then run the Codejock Grep utility and open the XML file, and press the Run button. When finished compile your project using the v15.0.1 OCX (COM).

Important Change: In version v13.4.2 and below Office2007Images just stored the path to a resource dll. In v15.0.1 and above this property is replaced with the ResourceImages class which has a LoadFromFile method to load the resource dll. This means even after running the migration script you will have to manually edit any code that used Office2007Images. There are code sample below to show how to use ResourceImages and LoadFromFile.

Download Migration XML File for ActiveX COM:
codejock-themes-migration.xml

Below is a list of enumeration and classes that have been renamed this release.

Renamed Enumerations and Classes

Below is a list of tables that contain enumerations and classes that have been renamed for this release. The left column represents the old name, and the right column represents the new name.

Jump To:   Classes - Enumerators - Supported Themes and Dlls - Sample VB Code - Sample MFC Code

Classes:

Old Name New Name
Office2007Images ResourceImages
back to top

Enumerators:

Old Name New Name
xtpCalendarThemeOffice2007xtpCalendarThemeResource
xtpThemeOffice2007xtpThemeResource
xtpPopupThemeOffice2007xtpPopupThemeResource
xtpAppearanceOffice2007xtpAppearanceResource
xtpGridThemeOffice2007xtpGridThemeResource
xtpColumnOffice2007 (COM Only)xtpColumnResource
xtpReportColumnOffice2007 (MFC Only)xtpReportColumnResource
xtpShortcutThemeOffice2007xtpShortcutThemeResource
xtpTaskPanelThemeShortcutBarOffice2007xtpTaskPanelThemeResource
ThemeOffice2007 (COM Only)ThemeResource
xtpPaneThemeOffice2007 (MFC Only)xtpPaneThemeResource
xtpTabColorOffice2007xtpTabColorResource
xtpToolTipOffice2007xtpToolTipResource
back to top

Using the Office 2007, Office 2010 and Windows 7 Themes:

The ResourceThemeImages object is used to tell the controls which resource to use for its appearance\theme. This will point to one of the "style" dlls that tells the control which colors to use. The "style" dlls hold images and colors for the specified theme. For example, Office 2007, Office 2007/2010 Ribbon, Office 2010 and Windows 7 appearances are stored in a resource dll that you need ResourceThemeImages to set these appearances.

ResourceThemeImages allows you to load the Resource Image Dll using the LoadFromFile method, it also contains the DllFileName and IniFileName. To utilize these styles the controls must set the theme to xxxThemeResource AFTER the resource dll has been loaded. The list of supported styles are listed below. In the code sample section there is a snippet of code to show how to use the Resource themes with each control.

Note: If you set the theme of the control to (control)ThemeResource and do not specify a resource dll the control will use the Office 2007 Blue theme.

Supported Styles Dlls as of version 15.0.1:

  • Office2007.dll
  • Office2010.dll
  • Windows7.dll
Each Styles Dll contains 1 or more styles:

Office2007.dll
  • Office2007Aqua.ini
  • Office2007Black.ini
  • Office2007Blue.ini
  • Office2007Silver.ini
Office2010.dll
  • Office2010Black.ini
  • Office2010Blue.ini
  • Office2010Silver.ini
Windows7.dll
  • Windows7Blue.ini

Note: You will need to include these dll files in your installation if you use them.

Example Code (Visual Basic)

These samples illustrates how to use the resources to set Office 2007, Office 2010 and Windows 7 themes

'*** Standard toolbars ***

'Set to the Office 2010 Blue.
    CommandBarsGlobalSettings.ResourceImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2010.dll", "Office2010Blue.ini"
    CommandBars.VisualTheme = xtpThemeResource
    CommandBars.PaintManager.RefreshMetrics
    CommandBars.RecalcLayout

'Set to the Office 2010 Black.
    CommandBarsGlobalSettings.ResourceImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2010.dll", "Office2010Black.ini"
    CommandBars.VisualTheme = xtpThemeResource
    CommandBars.PaintManager.RefreshMetrics
    CommandBars.RecalcLayout

'Set to the Office 2007 Blue.
    CommandBarsGlobalSettings.ResourceImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2007.dll", "Office2007Blue.ini"
    CommandBars.VisualTheme = xtpThemeResource
    CommandBars.PaintManager.RefreshMetrics
    CommandBars.RecalcLayout

'*** Ribbon Bar ***

'Set Ribbon theme to Office 2007 silver
    CommandBarsGlobalSettings.ResourceImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2007.dll", "Office2007Silver.ini"
    CommandBars.VisualTheme = xtpThemeRibbon
    ControlFile.Style = xtpButtonAutomatic
    CommandBars.PaintManager.RefreshMetrics
    CommandBars.RecalcLayout

'Set Ribbon theme to Office 2010 blue
    CommandBarsGlobalSettings.ResourceImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2010.dll", "Office2010Blue.ini"
    CommandBars.VisualTheme = xtpThemeRibbon
    ControlFile.Style = xtpButtonCaption
    CommandBars.PaintManager.RefreshMetrics
    CommandBars.RecalcLayout

'Set Ribbon theme to Windows 7 Scenic
    CommandBarsGlobalSettings.ResourceImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Windows7.dll,Windows7Blue.ini"
    CommandBars.VisualTheme = xtpThemeRibbon
    ControlFile.Style = xtpButtonCaption
    CommandBars.PaintManager.RefreshMetrics
    CommandBars.RecalcLayout

'*** Shortcut Bar ***

'Set ShortcutBar to Office 2007 Black
    ShortcutBarGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2007.dll,Office2007Black.ini"
    wndShortcutBar.VisualTheme = xtpShortcutThemeResource

'Set ShorcutBar to Office 2010 Black
    ShortcutBarGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2010.dll,Office2010Black.ini"
    wndShortcutBar.VisualTheme = xtpShortcutThemeResource

'*** Report Control ***

'Set ReprotControl to Office 2007 Black
    ReportControlGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2007.dll,Office2007Black.ini"
    wndReportControl.PaintManager.ColumnStyle = xtpColumnResource

'Set ReprotControl to Office 2010 Black
    ReportControlGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2010.dll,Office2010Black.ini"
    wndReportControl.PaintManager.ColumnStyle = xtpColumnResource

'*** Docking Pane ***

'Set Docking Pane to Office 2007 Black
    DockingPaneGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2007.dll,Office2007Black.ini"
    DockingPaneManager.VisualTheme = ThemeResource

'Set Docking Pane to Office 2010 Black
    DockingPaneGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2010.dll,Office2010Black.ini"
    DockingPaneManager.VisualTheme = ThemeResource

'*** Calendar ***

'Set Calendar to Office 2007 Black
    CalendarGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2007.dll,Office2007Black.ini"
    CalendarControl.VisualTheme = xtpCalendarThemeResource

'Set Calendar to Office 2010 Black
    CalendarGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2010.dll,Office2010Black.ini"
    CalendarControl.VisualTheme = xtpCalendarThemeResource

'*** Task Panel ***

'Set Task Panel to Office 2007 Black
    TaskPanelGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2007.dll,Office2007Black.ini"
    TaskPanelGlobalSettings.VisualTheme = xtpTaskPanelThemeResource

'Set Task Panel to Office 2010 Black
    TaskPanelGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2010.dll,Office2010Black.ini"
    TaskPanelGlobalSettings.VisualTheme = xtpTaskPanelThemeResource

'*** Property Grid ***

'Set Property Grid to Office 2007 Black
    PropertyGridGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2007.dll,Office2007Black.ini"
    PropertyGridGlobalSettings.VisualTheme = xtpGridThemeResource

'Set Property Grid to Office 2010 Black
    PropertyGridGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2010.dll,Office2010Black.ini"
    PropertyGridGlobalSettings.VisualTheme = xtpGridThemeResource

'*** Controls ***

'Set Controls to Office 2007 Black
    SuiteControlsGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2007.dll,Office2007Black.ini"
    ComboBox.Appearance = xtpAppearanceResource
    Button.Appearance = xtpAppearanceResource
    Edit.Appearance = xtpAppearanceResource
    RadioButton.Appearance = xtpAppearanceResource
    TreeView.Appearance = xtpAppearanceResource
    ListView.Appearance = xtpAppearanceResource
    ProgressBar.Appearance = xtpAppearanceResource
    ScrollBar.Appearance = xtpAppearanceResource
    HexEdit.Appearance = xtpAppearanceResource
    ColorPicker.Appearance = xtpAppearanceResource
    CheckBox.Appearance = xtpAppearanceResource

'Set Controls to Office 2010 Black
    SuiteControlsGlobalSettings.ResourceThemeImages.LoadFromFile _
        App.Path & "\..\..\..\Styles\Office2010.dll,Office2010Black.ini"
    ComboBox.Appearance = xtpAppearanceResource
    Button.Appearance = xtpAppearanceResource
    Edit.Appearance = xtpAppearanceResource
    RadioButton.Appearance = xtpAppearanceResource
    TreeView.Appearance = xtpAppearanceResource
    ListView.Appearance = xtpAppearanceResource
    ProgressBar.Appearance = xtpAppearanceResource
    ScrollBar.Appearance = xtpAppearanceResource
    HexEdit.Appearance = xtpAppearanceResource
    ColorPicker.Appearance = xtpAppearanceResource
    CheckBox.Appearance = xtpAppearanceResource

MFC Notes

In including the resource in your exe you need to add that resource to your project's resource file. For example:

#include "Styles\Office2007\Office2007.rc"

or

#include "Styles\Office2010\Office2010.rc"

If including as an external Dll, then you simply need to pass in the path to the dll to the SetHandle method. For Example:

XTPResourceImages()->SetHandle(
    _T("\..\..\..\Styles\Office2010.dll"), _T("OFFICE2010BLACK.INI"));

Example Code (MFC)

These samples illustrates how to use the resources to set Office 2007, Office 2010 and Windows 7 themes

//*** Docking Pane ***
//Set Docking Pane to Office 2010 Black

XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2010BLACK.INI"));
m_paneManager.SetTheme(xtpPaneThemeResource);

'*** Standard toolbars and Ribbon ***

'Set to the Office 2010 Blue.
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2010BLUE.INI"));
pCommandBars->SetTheme(xtpThemeResource);

'Set to the Office 2010 Black.
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2010BLACK.INI"));
pCommandBars->SetTheme(xtpThemeResource);

'Set to the Office 2007 Blue.
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2007BLUE.INI"));
pCommandBars->SetTheme(xtpThemeResource);

'*** Shortcut Bar ***

'Set ShortcutBar to Office 2007 Black
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2007BLACK.INI"));
m_shortcutBar.SetTheme(xtpShortcutThemeResource);

'Set ShorcutBar to Office 2010 Black
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2010BLACK.INI"));
m_shortcutBar.SetTheme(xtpShortcutThemeResource);

'*** Report Control ***

'Set ReprotControl to Office 2007 Black
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2007BLACK.INI"));
m_reportControl.GetPaintManager()->SetColumnStyle(xtpReportColumnResource);

'Set ReprotControl to Office 2010 Black
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2010BLACK.INI"));
m_reportControl.GetPaintManager()->SetColumnStyle(xtpReportColumnResource);

'*** Calendar ***

'Set Calendar to Office 2007 Black
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2007BLACK.INI"));
m_calendarControl.SetTheme(xtpCalendarThemeResource);

'Set Calendar to Office 2010 Black
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2010BLACK.INI"));
m_calendarControl.SetTheme(xtpCalendarThemeResource);

'*** Task Panel ***

'Set Task Panel to Office 2007 Black
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2007BLACK.INI"));
m_taskPanel.SetTheme(xtpTaskPanelThemeResource);

'Set Task Panel to Office 2010 Black
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2010BLACK.INI"));
m_taskPanel.SetTheme(xtpTaskPanelThemeResource);

'*** Property Grid ***

'Set Property Grid to Office 2007 Black
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2007BLACK.INI"));
m_propertyGrid.SetTheme(xtpGridThemeResource);

'Set Property Grid to Office 2010 Black
XTPResourceImages()->SetHandle(AfxGetInstanceHandle(), _T("OFFICE2010BLACK.INI"));
m_propertyGrid.SetTheme(xtpGridThemeResource);