在调整表单大小时,BackgroundImage会闪烁吗? [英] BackgroundImage flickers when resizing the form?

查看:114
本文介绍了在调整表单大小时,BackgroundImage会闪烁吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能帮我解决一下糟糕的表现吗?我的表单有一个图像作为BackgroundImage,我使用一个计时器将表单的大小逐渐增加到一定的大小。然后它会在启动计时器之前停止并恢复大小。但在增加大小时,我的表单的BackgroundImage闪烁。如何让它不那样?

非常感谢!

解决方案

您可以尝试将Forms DoubleBuffered属性设置为true。 / blockquote>

回答后续问题:



但是我无法访问该受保护的财产。
您可以始终访问并设置双缓冲功能。



对于控件(包括表单):不使用预定义控件。创建派生类并在表单中使用它而不是原始类。使用 System.Windows.Forms.Control.SetStyle 。添加样式 System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer | System.Windows.Forms.ControlStyles.AllPaintingInWmPaint



关于表格 - 你在说什么?您已经使用了从 System.Windows.Forms.Form 派生的类,因此您可以访问任何受保护的成员。



那就是说 - 考虑你的闪烁问题解决者。试试吧!



-SA


您还可以将控件打印到某个图像缓存中RAM然后将其导出到表单的绘图表面...这将减少闪烁


Could you please help me fix that bad performance? My form has an image as its BackgroundImage, I use a timer to increase the size of the form gradually to a certain size. Then it will stop and recover the size as before starting the timer. But during increasing the size, my form's BackgroundImage was flickering. How to make it not like that?
Thank you so much!

解决方案

You could try setting the Forms DoubleBuffered Property to true.


Answering follow-up question:

But I can't access to that protected property.
You can always access and set double buffer feature.

For controls (including Form): do not use predefined control. Create a derived class and use it in your form instead of original one. Use System.Windows.Forms.Control.SetStyle. Add the style System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer | System.Windows.Forms.ControlStyles.AllPaintingInWmPaint.

As to the Form — what are you talking about? You already use the class derived from System.Windows.Forms.Form, so any protected members are accessible to you.

That said — consider your flicker problem solver. Try it!

—SA


You can also print your control into some image cache in RAM and then export it onto form's drawing surface ... that would decrease flickering


这篇关于在调整表单大小时,BackgroundImage会闪烁吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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