【问题标题】:Detect Aero or Classic theme in WPF在 WPF 中检测 Aero 或 Classic 主题
【发布时间】:2014-01-30 19:13:29
【问题描述】:

我发现了有关如何加载资源字典以应用特定 Windows 主题的问题,such as this question,但如果 Windows 主题已设置为 aero,我不想为 aero 加载资源字典,是否可以在后面的代码中做一些事情可以确定当前的 windows 主题是什么?

【问题讨论】:

    标签: c# wpf themes


    【解决方案1】:

    您可以尝试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
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-28
      • 2017-05-11
      • 2011-09-15
      • 2010-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-11
      相关资源
      最近更新 更多