C#: Does SuspendLayout cascade to child controls?
Do I have to iterate the child of the control myself to call suspendlayout on them? and on their grand child? grand grand child?? grand grand grand child?
Thanks
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.
What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
SuspendLayout
doesn't propagate recursively, but depending on what you are doing, suspending just specific controls may be enough.
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. 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. Children only get one resize each, so no need to suspend them. But each one of those children would cause the parent to relayout, so suspend the parent to do all those relayouts in bulk once you call ResumeLayout
.Size
, Location
and Bounds
properties on multiple children, you should suspend both the parent and the children. All of them will have multiple layout events triggering. Just be sure to only resume the parent after all its children have resumed. Otherwise, each of the children's ResumeLayout
s would cause a relayout of the parent so you would get no benefit from suspending it in the first place.Size
of the parent, no need to suspend anything. 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. It already does it every time the user resizes the window, for instance.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With