public void PerformLayout(Control affectedControl, string affectedProperty) {
LayoutEventArgs levent = new LayoutEventArgs(affectedControl, affectedProperty);
Control[] ctrls = Controls.GetAllControls();
foreach (Control c in ctrls)
if (c.recalculate_distances)
c.UpdateDistances ();
if (layout_suspended > 0) {
layout_pending = true;
return;
}
layout_pending = false;
// Prevent us from getting messed up
layout_suspended++;
// Perform all Dock and Anchor calculations
try {
OnLayout(levent);
}
// Need to make sure we decremend layout_suspended
finally {
layout_suspended--;
}
}