开发者

C# Why use SuspendLayout()?

开发者 https://www.devze.com 2023-01-18 20:36 出处:网络
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.

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.

It has something to do with setting properties like Dock, Anchor, Location, etc.

But I don't understand what the additional value is of Suspend- and Re开发者_StackOverflowsumeLayout(). 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".

0

精彩评论

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