private static Point GetNewLocation(Form parent, Form child, ChildFormPosition position) { Point newLocation = Point.Empty; switch (position) { case ChildFormPosition.TopLeft: newLocation = new Point(parent.Location.X, parent.Location.Y - child.Size.Height); break; case ChildFormPosition.TopRight: newLocation = new Point(parent.Location.X + parent.Size.Width, parent.Location.Y); break; case ChildFormPosition.BottomLeft: newLocation = new Point(parent.Location.X, parent.Location.Y + parent.Height + 1); break; case ChildFormPosition.BottomCentre: newLocation = new Point( parent.Location.X + ((parent.Size.Width - child.Size.Width) / 2), parent.Location.Y + parent.Size.Height); break; case ChildFormPosition.BottomRight: newLocation = new Point( parent.Location.X + parent.Width - child.Width, parent.Location.Y + parent.Height + 1); break; case ChildFormPosition.MiddleLeft: newLocation = new Point( parent.Location.X + 50, ((parent.ClientSize.Height - child.ClientSize.Height) / 2) + parent.Location.Y); break; case ChildFormPosition.MiddleCentre: newLocation = new Point( ((parent.ClientSize.Width - child.ClientSize.Width) / 2) + parent.Location.X, ((parent.ClientSize.Height - child.ClientSize.Height) / 2) + parent.Location.Y); break; default: break; } return(newLocation); }
private static void PositionChildForm(Form parent, Form child, ChildFormPosition position) { child.Location = GetNewLocation(parent, child, position); }
private static Point GetNewLocation(Form child, ChildFormPosition position) { return(GetNewLocation(_mainForm, child, position)); }
private static void PositionChildForm(Form child, ChildFormPosition position) { PositionChildForm(_mainForm, child, position); }
private static Point GetNewLocation(Form parent, Form child, ChildFormPosition position) { Point newLocation = Point.Empty; switch (position) { case ChildFormPosition.TopLeft: newLocation = new Point(parent.Location.X, parent.Location.Y - child.Size.Height); break; case ChildFormPosition.TopRight: newLocation = new Point(parent.Location.X + parent.Size.Width, parent.Location.Y); break; case ChildFormPosition.BottomLeft: newLocation = new Point(parent.Location.X, parent.Location.Y + parent.Height + 1); break; case ChildFormPosition.BottomCentre: newLocation = new Point( parent.Location.X + ((parent.Size.Width - child.Size.Width) / 2), parent.Location.Y + parent.Size.Height); break; case ChildFormPosition.BottomRight: newLocation = new Point( parent.Location.X + parent.Width - child.Width, parent.Location.Y + parent.Height + 1); break; case ChildFormPosition.MiddleLeft: newLocation = new Point( parent.Location.X + 50, ((parent.ClientSize.Height - child.ClientSize.Height) / 2) + parent.Location.Y); break; case ChildFormPosition.MiddleCentre: newLocation = new Point( ((parent.ClientSize.Width - child.ClientSize.Width) / 2) + parent.Location.X, ((parent.ClientSize.Height - child.ClientSize.Height) / 2) + parent.Location.Y); break; default: break; } return newLocation; }
private static Point GetNewLocation(Form child, ChildFormPosition position) { return GetNewLocation(_mainForm, child, position); }