更改面板位置时发生轻弹 [英] Flickring Occurs while changing position of a panel
本文介绍了更改面板位置时发生轻弹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨 我正在使用计时器将面板从点移动到另一个.但是移动屏幕会闪烁很多.如何停止屏幕闪烁.请有人帮忙.
Hi I am using a timer to move a panel from on point to another. But moving the screen flickers a lot. How do i stop flickering of screen. Somebody please help.
推荐答案
我看不到到底是什么在闪烁.尝试在父窗体(或移动面板的父控件)或面板本身或两者上设置双重缓冲,然后看看会发生什么.使用属性System.Windows.Forms.Control.DoubleBuffered
.对于控件(Panel
),它还需要调用受保护的SetStyle
,因此请在派生类中进行操作.您将需要添加样式System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer | System.Windows.Forms.ControlStyles.AllPaintingInWmPaint
.
参见:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.setstyle.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.doublebuffered.aspx [ ^ ].
—SA
I did not see what exactly flickering. Try to set double buffering on parent form (or a parent control of moving panel) or panel itself, or both and see what happens. Use the propertySystem.Windows.Forms.Control.DoubleBuffered
. For a control (Panel
) it also requires calling protectedSetStyle
, so do it in your derived class. You will need to add stylesSystem.Windows.Forms.ControlStyles.OptimizedDoubleBuffer | System.Windows.Forms.ControlStyles.AllPaintingInWmPaint
.
See:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.setstyle.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.doublebuffered.aspx[^].
—SA
这篇关于更改面板位置时发生轻弹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文