Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSTO - MS Office 'Color Scheme' changed event

Tags:

vsto

Using VSTO, how can I get notification of changes to the MS Office color scheme?

like image 846
Gareth Hayter Avatar asked Sep 03 '25 14:09

Gareth Hayter


1 Answers

Hopefully something better exists with Office 2010. Here's what I used for Office 2007 and Word (This is not a notification in any way, just something to check for):

const string OfficeCommonKey =
  @"Software\Microsoft\Office\12.0\Common";
const string OfficeThemeValueName = "Theme";
const int ThemeBlue = 1;
const int ThemeSilver = 2;
const int ThemeBlack = 3;

using (RegistryKey key = Registry.CurrentUser.OpenSubKey(OfficeCommonKey, false))
{
    int theme = (int)key.GetValue(OfficeThemeValueName,1);

    switch (theme)
    {
        case ThemeBlue:
            //...
            break;
        case ThemeSilver:
            //...
            break;
        case ThemeBlack:
            //...
            break;
        default:
            //...
            break;
   }
}
like image 55
Michael Regan Avatar answered Sep 05 '25 16:09

Michael Regan