usingSystem;usingSystem.Windows.Forms;usingSystem.Collections;usingSystem.Drawing;namespaceShrinkAreaTest
{public classShrinkArea
{
Form form;bool expanded = true;boolvertical;intareaSize;
Hashtable areaControls= newHashtable();
Hashtable outsideControls= newHashtable();publicRectangle GetFormRelativeBounds(Control control)
{
Control current =control;
Form form=control.FindForm();int x = 0;int y = 0;while (current !=control.FindForm())
{
x+=current.Location.X;
y+=current.Location.Y;
current=current.Parent;
}
return newRectangle(x, y, control.Bounds.Width, control.Bounds.Height);
}public ShrinkArea(Form form, int areaBegin, int areaEnd,boolvertical)
{this.vertical =vertical;this.form =form;this.areaSize = areaEnd -areaBegin;