禁用对话框上的航空淡入效果

禁用对话框上的航空淡入效果

本文介绍了禁用对话框上的航空淡入效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 MFC 创建一个模态对话框.当它出现时,Aero 主题会为出现的新窗口淡入过渡.在我的特殊情况下,我会立即从一个对话框切换到另一个对话框,并且淡入淡出效果会分散注意力.有没有办法可以禁用它,以便立即出现窗口,就像禁用 Aero 时一样,但不会完全关闭 Aero?

I have a modal dialog I'm creating with MFC. When it appears, the Aero theme does it's fade-in transition for a new window appearing. In my particular case I'm switching immediately from one dialog to another and the fade effect is distracting. Is there a way it can be disabled so the window immediately appears, like it does when Aero is disabled, but without switching Aero off completely?

推荐答案

DwmSetWindowAttribute 函数或许能帮到你.它允许您修改与 DWM 相关的许多窗口属性.特别是,DWMWA_TRANSITIONS_FORCEDISABLED 属性提到启用或强制禁用 DWM 转换",这可能会起到作用.

The DwmSetWindowAttribute function might be able to help you. It lets you modify a number of window attributes related to the DWM. In particular, the DWMWA_TRANSITIONS_FORCEDISABLED attribute mentions "Enable or forcibly disable DWM transitions", which just might do the trick.

HRESULT hr = S_OK;
LPCVOID dwAttribute  = (LPCVOID)TRUE;

hr = DwmSetWindowAttribute(hWnd, DWMWA_TRANSITIONS_FORCEDISABLED,
        &dwAttribute, sizeof(dwAttribute));

if (SUCCEEDED(hr))
{
   // The transitions should have been disabled
}

这篇关于禁用对话框上的航空淡入效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 23:36