I tried to use the ControlCollection class defined inside the System.Windows.Forms.Control to use as temporary storage of layout-affected controls in my last post.
Not knowing the internals of the said class, I got some problems when child controls of the container control are not added to my instance of ControlCollection after invoking the Add method.
Note that the default and only constructor of ControlCollection takes a Control instance as its owner. Since I don’t want to mess up the original ControlCollection of my container control, I just passed the container control as the parameter to the constructor. Upon looking at the disassembled code for the ControlCollection class, I was surprise that there is a handle if the control being added is already parented and its parent is the same as the owner of the ControlCollection instance being added to:
if (value.parent == this.owner)
Now this is the handler that I was seeking before when I tried to re-add controls already existing in the ControlCollection without getting any exceptions.