为Winform配置双缓冲避免闪屏
2020-12-13 13:43
阅读:536
标签:winform style blog http color io os ar for
最近新做了一个项目,项目的界面好多的控件,然后在进入界面的时候会刷新好多次,而且每次操作都有不必要的刷新,研究发现了需要配置双缓冲才能避免闪屏,代码如下。


1 //获取当前系统的环境版本,不同的环境对应不同的属性。 2 Version v = System.Environment.Version; 3 4 if (v.Major 2) 5 { 6 this.SetStyle(ControlStyles.DoubleBuffer, true); 7 } 8 else 9 { 10 this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); 11 } 12 13 this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); 14 this.SetStyle(ControlStyles.UserPaint, true); 15 this.SetStyle(ControlStyles.ResizeRedraw, true);
为Winform配置双缓冲避免闪屏
标签:winform style blog http color io os ar for
原文地址:http://www.cnblogs.com/liehuochongsheng/p/4053622.html
评论
亲,登录后才可以留言!