的Visual C#的形式更新的结果闪烁 [英] visual c# form update results in flickering
问题描述
我有我写在C#.NET应用程序。在一些形式我经常更新显示的字段。在某些情况下,形式(文本框,标签,PictureBox的,等等)上的每个字段有其值改变了。加上变化的频率也可能会被每一秒。然而,目前有一个可怕的每次闪烁的形式更新。如何停止闪烁?有没有一种办法,也许双缓冲?请帮忙!
I have a .net app that I've written in c#. On some forms I frequent update the display fields. In some cases every field on the form (textboxes, labels, picturebox, etc) has its value changed. Plus the frequency of the changes could possibly be every second. However, currently there is a horrible flickering everytime the form is updated. How can I stop the flickering? Is there a way to maybe double buffer? Please help!
推荐答案
简单的答案是
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
只是乐趣,尝试调用Application.DoEvents()的每个元素更新完毕后,看看问题是否变得更好或更坏; - )
just for fun, try calling Application.DoEvents() after each element is updated, and see if the problem gets better or worse ;-)
这篇关于的Visual C#的形式更新的结果闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!