开发者

how to avoid flickering while changing the controls in the panel very often?

i often change the controls in the panel while doing this flickering occurs how to avoid this.

i have ten usercontrols,before placin a control i wil开发者_Python百科l clear the contents of the panel and add a newone to the panel.


The another way mentioned by ChrisBD would be a

myPanel.SuspendLayout()
//adding and removing all UserControls
//...
myPanel.ResumeLayout(false)


The flickering is caused by all of the screen refreshes that occur as you change your controls.

An option would be to have two panels, one live and visible and the other invisible. Add or remove controls on the hidden panel and then swap them when the changes are complete.

There is another way to prevent the refreshes from happening, but unfortunately I'm away from my coding machine and can't give an examp[le at the moment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜