C# 显示窗体显示是闪烁的问题
来源:互联网 发布:嵌入式软件开发培训 编辑:程序博客网 时间:2024/05/22 14:23
一般是在窗体加载大背景图后,页面控件加载的时候会出现闪现问题。
经过长时间寻找发现神代码,直接加载到页面对应的类文件下即可。
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000;
return cp;
}
}
原理很简单,引用以下原话:
A form that has a lot of controls takes a long time to paint. Especially the Button control in its default style is expensive. Once you get over 50 controls, it starts getting noticeable. The Form class paints its background first and leaves "holes" where the controls need to go. Those holes are usually white, black when you use the Opacity or TransparencyKey property. Then each control gets painted, filling in the holes. The visual effect is ugly and there's no ready solution for it in Windows Forms. Double-buffering can't solve it as it only works for a single control, not a composite set of controls.
I discovered a new Windows style in the SDK header files, available for Windows XP and (presumably) Vista: WS_EX_COMPOSITED. With that style turned on for your form, Windows XP does double-buffering on the form and all its child controls.
- C# 显示窗体显示是闪烁的问题
- MDI父窗体添加背景、背景上显示自动换行文本并解决闪烁的问题
- 窗体闪烁的问题
- C# winForm 窗体闪烁问题
- 窗体的调用显示问题
- C#中子主窗体显示问题
- MDI窗体与子窗体的显示问题--(如何让主窗体是被控件挡住的子窗体显示)
- C#显示窗体
- c# 全屏显示窗体
- C#多文档的窗体显示
- C# 中不显示窗体的标题栏
- c# 窗体全屏显示的完整范例
- c# 窗体全屏显示的完整范例
- c# 弹出窗体的显示位置设定
- c# 窗体全屏显示的完整范例
- C# 窗体程序界面显示和操作word 单是不依赖office的操作办法
- BCB窗体显示问题
- 窗体的显示、关闭或隐藏问题
- Python----字符编码方法
- MFC 怎么 调用dll文件里带结构体的函数 求大神
- Cluster中3个Nodes挂掉2个,恢复Recovery Pending的DB的方案探索(续)
- CCLabelTTF的多行显示(仅限中文)
- 2.6.29内核定制、编译、安装到X86上
- C# 显示窗体显示是闪烁的问题
- GStreamer学习笔记(一)
- Fedora9.0上网配置
- PE文件 COFF文件格式
- 【ARM学习笔记】实验四:内存管理单元MMU的虚拟地址映射实验
- LAC+CELLID定位手机位置
- 折半查找
- Java泛型的全面总结
- linux中使用ssh或scp时如何跳过RSA key fingerprint输入yes/no