public void Center(bool restraint)
{
GComponent r;
if (parent != null)
r = parent;
else
r = this.root;
this.SetXY((int)((r.width - this.width) / 2), (int)((r.height - this.height) / 2));
if (restraint)
{
this.AddRelation(r, RelationType.Center_Center);
this.AddRelation(r, RelationType.Middle_Middle);
}
}