c#源码:
public static string GetCdrTheme(corel.Application app)
{
try
{
RegistryKey hkml = Registry.CurrentUser;
RegistryKey software = hkml.OpenSubKey("Software\\Corel\\CorelDRAW\\" + app.VersionMajor + ".0\\Draw\\Application Preferences\\WindowScheme");
if (software != null)
{
object theme = software.GetValue("Colors");
if (theme != null)
{
return theme.ToString();
}
}
return "Scheme_01_LightestGrey";
}
catch
{
return "Scheme_01_LightestGrey";
}
}
private void InitCdrEventListener()
{
allClass.setapp.Application.OnApplicationEvent += CdrApp_OnApplicationEvent;
}
private void CdrApp_OnApplicationEvent(string EventName, ref object[] Parameters)
{
if (EventName.Equals("WorkspaceChanged") || EventName.Equals("OnColorSchemeChanged"))
{
string result = allClass.setapp.Application.GetApplicationPreferenceValue("WindowScheme", "Colors").ToString();
if (result == "Scheme_01_LightestGrey")
{
Resources.MergedDictionaries.Clear();
Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(@"pack://application:,,,/Sky;component/Style/zhuti1.xaml", UriKind.RelativeOrAbsolute) });
Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(@"pack://application:,,,/Sky;component/Style/imageblack.xaml", UriKind.RelativeOrAbsolute) });
}
if (result == "Scheme_02_MediumGrey")
{
Resources.MergedDictionaries.Clear();
Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(@"pack://application:,,,/Sky;component/Style/zhuti2.xaml", UriKind.RelativeOrAbsolute) });
Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(@"pack://application:,,,/Sky;component/Style/imageblack.xaml", UriKind.RelativeOrAbsolute) });
}
if (result == "Scheme_03_DarkGrey")
{
Resources.MergedDictionaries.Clear();
Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(@"pack://application:,,,/Sky;component/Style/zhuti3.xaml", UriKind.RelativeOrAbsolute) });
Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(@"pack://application:,,,/Sky;component/Style/imagewhite.xaml", UriKind.RelativeOrAbsolute) });
}
if (result == "Scheme_04_Black")
{
Resources.MergedDictionaries.Clear();
Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(@"pack://application:,,,/Sky;component/Style/zhuti4.xaml", UriKind.RelativeOrAbsolute) });
Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(@"pack://application:,,,/Sky;component/Style/imagewhite.xaml", UriKind.RelativeOrAbsolute) });
}
allClass.xmlxg("SkyZt", result);
}
}