摇曳在Windows窗体应用程序 [英] Flickering in a Windows Forms app

查看:221
本文介绍了摇曳在Windows窗体应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有了一吨就可以控制的应用程序。它有闪烁的巨量,尤其是在启动时。

I have an app that has a ton of controls on it. And it has a massive amount of flicker, particularly on startup.

我应用这个<一个href=\"http://stackoverflow.com/questions/2612487/how-to-fix-the-flickering-in-user-controls/2613272#2613272\">fix吧。

    protected override CreateParams CreateParams
    {
        get
        {
            CreateParams cp = base.CreateParams;
            cp.ExStyle |= 0x02000000;   // WS_EX_COMPOSITED
            return cp;
        }
    } 

这伟大的工作 - 闪烁减少了一个pretty数量惊人。但是,副作用是最小化,最大化,当我将鼠标移动到窗口右上角的关闭按钮不动画或者点击它们(他们仍然工作,虽然)。这使应用程序挂起的感觉。

This worked great - the flickering was reduced by a pretty unbelievable amount. However, the side effect is that the Minimize, Maximize and the Close buttons in the top right of the window don't animate when I move the mouse over or click on them (they still work though). This gives the app a hung feel.

我如何保持WS_EX_COMPOSITED同时仍保留最大化的可用性,最小化和关闭按钮?

How do I keep the WS_EX_COMPOSITED while still retaining the usability of Maximize, Minimize and Close buttons?

这发生在Windows XP中。由于@fallenidol指出,这是不是在Windows 7上的问题。

This happens on Windows XP. As @fallenidol pointed out, this is not an issue on Windows 7.

推荐答案

我想通了。关键是要去除WS_EX_COMPOSITED标志所示的形式之后。在我的博客的完整的解释和code:

I figured it out. The trick is to remove the WS_EX_COMPOSITED flag after the form is shown. The full explanation and code at my blog:

<一个href=\"http://www.angryhacker.com/blog/archive/2010/07/21/how-to-get-rid-of-flicker-on-windows-forms-applications.aspx\">How得到的Windows摆脱闪烁的窗体应用程序

这篇关于摇曳在Windows窗体应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆