C#为什么要使用SuspendLayout()? [英] C# Why use SuspendLayout()?

查看:856
本文介绍了C#为什么要使用SuspendLayout()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读了关于 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.

它是与设置如码头位置

但我不明白的附加值中止反应和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()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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