问题描述
我读了关于 SuspendLayout()
和 ResumeLayout()
。我想不通的是,为什么我应该做/使用。我知道你使用它,当你在运行时将控制容器中添加控件。
I am reading up about SuspendLayout()
and ResumeLayout()
. What I can't figure out is, why should I do/use this. I know you use it when you add controls at runtime to a control-container.
它是与设置如码头性能code>,
锚
,位置
等
但我不明白的附加值中止反应和ResumeLayout()的内容。 ?什么这些方法照顾了。
But I don't understand what the additional value is of Suspend- and ResumeLayout(). What does these methods take care for?
推荐答案
基本上它,如果你要调整多个布局相关的属性 - 或添加多个孩子 - 但避免反复反应更改布局系统。你希望它的只有的在最后进行布局,当一切的准备就绪。
Basically it's if you want to adjust multiple layout-related properties - or add multiple children - but avoid the layout system repeatedly reacting to your changes. You want it to only perform the layout at the very end, when everything's "ready".
这篇关于C#为什么要使用SuspendLayout()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!