【发布时间】:2014-01-30 19:13:29
【问题描述】:
我发现了有关如何加载资源字典以应用特定 Windows 主题的问题,such as this question,但如果 Windows 主题已设置为 aero,我不想为 aero 加载资源字典,是否可以在后面的代码中做一些事情可以确定当前的 windows 主题是什么?
【问题讨论】:
我发现了有关如何加载资源字典以应用特定 Windows 主题的问题,such as this question,但如果 Windows 主题已设置为 aero,我不想为 aero 加载资源字典,是否可以在后面的代码中做一些事情可以确定当前的 windows 主题是什么?
【问题讨论】:
您可以尝试DwmIsCompositionEnabled 功能...它仅适用于当前活跃的用户。
[DllImport("dwmapi.dll")]
public static extern IntPtr DwmIsCompositionEnabled(out bool pfEnabled);
bool aeroEnabled = false;
if (NativeMethods.DwmIsCompositionEnabled(out aeroEnabled) == IntPtr.Zero)
{
//Some code here
}
【讨论】: