是否有任何 api 或我们确定的东西,玻璃效果已经激活?在我看到的一些代码中,如果 DllNotFoundException
抛出,那么他们会确保它不活动或不存在。有更好的或标准的方法吗?
这是将 Aero Effect 用于 extend glass area in WPF 的解决方案.
最佳答案
关于 this MSDN page它建议您可以使用 DwmIsCompositionEnabled 检测 Glass :
When the status of desktop composition is changed, a WM_DWMCOMPOSITIONCHANGED message is broadcast. There are no parameters telling you if it's being enabled or disabled, so it's up to you to call DwmIsCompositionEnabled if you're interested. The code to do the check is straightforward-the tricky part is deciding how you want your window to look if composition is disabled.
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern bool DwmIsCompositionEnabled();
// Check to see if composition is Enabled
if (Environment.OSVersion.Version.Major >= 6 && DwmIsCompositionEnabled())
{
// enable glass rendering
}
else
{
// fallback rendering
}
但是我不确定您是否可以“启用 Aero”但“禁用 Glass”,如果可以,该方法的结果会是什么。
关于c# - 如何确保启用 Aero 效果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5114389/