如何才能确保效果的Aero启用?

编程入门 行业动态 更新时间:2024-10-19 14:42:45
本文介绍了如何才能确保效果的Aero启用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否有任何API或东西,我们要确保,玻璃效果已经活化?在一些codeS,我看到,如果 DllNotFoundException 抛出,然后他们要确保它不主动或不存在。有没有更好的或者标准的方式?

这是使用的Aero效果,以在WPF

解决方案

在这个MSDN页它表明你可以使用玻璃DwmIsCompositionEnabled:

  

在桌面组合的状态  被改变时,一个WM_DWMCOMPOSITIONCHANGED  消息播出。有没有  参数告诉你,如果它被  启用或禁用,所以它是由你  调用DwmIsCompositionEnabled如果  你有兴趣。在code做  检查很简单,棘手  一部分是决定你希望你  看窗口,如果成分  禁用。

函数[DllImport(dwmapi.dll文件,preserveSig = FALSE)]公共静态外部布尔DwmIsCompositionEnabled();//检查是否组成启用如果(Environment.OSVersion.Version.Major&GT = 6和;&放大器; DwmIsCompositionEnabled()){    //使玻璃渲染}其他{    //后备渲染}

不过,我不知道你是否能启用Aero的,而是禁用玻璃,如果是这样,该方法的结果会是什么。

Is there any api or something that we make sure, Glass effect is already actived? In some codes that i saw, if DllNotFoundException throws, then they make sure it's not active or not exists. is there a better or standard way?

This is the solution for Using Aero Effect to extend glass area in WPF.

解决方案

On this MSDN page it suggests you can detect Glass using DwmIsCompositionEnabled:

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 }

However I'm not sure whether you can "Enable Aero" but "Disable Glass" and if so, what the result of the method would be.

更多推荐

如何才能确保效果的Aero启用?

本文发布于:2023-11-12 04:00:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580459.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:效果   Aero

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!