:
Form.Dispose :
protected override void Dispose(bool disposing)
{
if (disposing)
{
... lots and lots of weird optimized checks ...
base.Dispose(disposing);
Ok ... Formis ContainerControltherefore:
ContainerControl.Dispose:
protected override void Dispose(bool disposing)
{
if (disposing)
{
this.activeControl = null;
}
base.Dispose(disposing);
this.focusedControl = null;
this.unvalidatedControl = null;
}
Grrr * ... ok, ContainerControlis Control:
Control.Dispose:
protected override void Dispose(bool disposing)
{
... a whole lot of resource reclaiming/funky code ...
ControlCollection controls = (ControlCollection)
this.Properties.GetObject(PropControlsCollection);
if (controls != null)
{
for (int i = 0; i < controls.Count; i++)
{
Control control = controls[i];
control.parent = null;
control.Dispose();
}
this.Properties.SetObject(PropControlsCollection, null);
}
base.Dispose(disposing);
So yes; the call Disposein the form will contain the controls contained in it.
source
share