是否有任何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启用?
发布评论