如何修复C#桌面应用程序中的表单闪烁 [英] How to fix Form Flickering in C# Desktop Application

查看:68
本文介绍了如何修复C#桌面应用程序中的表单闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#3.5桌面应用程序上有一个应用程序,SQL 2005作为后端。我登录到应用程序后出现问题,当我从特殊的子项中拉出不同的表单时,表单会在屏幕上出现之前像管灯一样闪烁,如果我将图像背景添加到屏幕上,它会闪烁更多形成。请帮助..

I have an application on C# 3.5 desktop application with SQL 2005 as back end. There is a problem after I log in to the application, when I pull different forms specially child from, the form would blink like a tube light before it appears on the screen and more over it would blink more if I add an image background to the form. Please Help..

推荐答案

奇怪的是检查你做了一些冲突的油漆事件或者你正在调整运行时的一些动态控制加载事件构造函数 ...



如果你不想显示闪烁

表示代码如下将在完成绘画后显示您的表格



将此属性放入您的表单并检查效果

it is strange check you have done some paint event that is conflicting or some dynamic control which you are adjusting runtime on load event or in constructor...

if you want to not show flicker
means below code will show your form after it complete painting

put this property in your form and check effect
protected override CreateParams CreateParams 
{
    get {
        CreateParams cp = base.CreateParams;
        cp.ExStyle = cp.ExStyle | 0x2000000;
        return cp;
    }
}

快乐编码!

:)

Happy Coding!
:)


这篇关于如何修复C#桌面应用程序中的表单闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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