[英](C#) Does SuspendLayout cascade to child controls?
C#: Does SuspendLayout cascade to child controls? C#:SuspendLayout 是否级联到子控件?
Do I have to iterate the child of the control myself to call suspendlayout on them?我是否必须自己迭代控件的子项才能对它们调用 suspendlayout? and on their grand child?
和他们的孙子? grand grand child??
大孙子?? grand grand grand child?
大孙子?
Thanks谢谢
SuspendLayout
doesn't propagate recursively, but depending on what you are doing, suspending just specific controls may be enough. SuspendLayout
不会递归传播,但取决于您在做什么,仅暂停特定控件可能就足够了。
The rule of a thumb is: you suspend the control whose layout you are about to mess with more than once.经验法则是:您暂停要多次弄乱其布局的控件。
For instance:例如:
Size
property of one child, no need to suspend anything.Size
属性,则无需暂停任何内容。 The child will be changed only once, and that will, in turn, cause only one change in the parent.Size
of multiple children, you should only suspend the parent.Size
,则应仅暂停父项。 Children only get one resize each, so no need to suspend them.ResumeLayout
.ResumeLayout
,就暂停父级以批量执行所有这些重新布局。Size
, Location
and Bounds
properties on multiple children, you should suspend both the parent and the children.Size
、 Location
和Bounds
属性,则应暂停父项和子项。 All of them will have multiple layout events triggering.ResumeLayout
s would cause a relayout of the parent so you would get no benefit from suspending it in the first place.ResumeLayout
s 都会导致父级的重新布局,因此您不会从一开始就挂起它没有任何好处。Size
of the parent, no need to suspend anything.Size
,则无需暂停任何内容。 This will indirectly modify a bunch of children, but the parent is the one doing their modifications so it should already know how to handle that efficiently.Yes;是的; SuspendLayout stops the control being painted (or rather layout requests being processed), which by default trickles down the child structure.
SuspendLayout 停止正在绘制的控件(或者更确切地说是正在处理的布局请求),默认情况下它会沿着子结构向下传递。
In other words: there is "no-one" calling the paint routine anymore.换句话说:不再有“没有人”调用绘制程序了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.