VSTO - MS Office“配色方案"更改事件 [英] VSTO - MS Office 'Color Scheme' changed event

查看:35
本文介绍了VSTO - MS Office“配色方案"更改事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 VSTO,我如何获得有关 MS Office 配色方案更改的通知?

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

推荐答案

希望 Office 2010 存在更好的东西.这是我用于 Office 2007 和 Word 的内容(这不是任何形式的通知,只是需要检查的内容):

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;
   }
}

这篇关于VSTO - MS Office“配色方案"更改事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆