private static Point AlignContent(Rectangle container, ContentAlignment alignment, Size content)
 {
     switch (alignment)
     {
         case ContentAlignment.BottomLeft: return new Point(container.Left, container.Bottom - content.Height);
         case ContentAlignment.BottomCenter: return new Point(container.HorizontalCenter() - content.Width / 2, container.Bottom - content.Height);
         case ContentAlignment.BottomRight: return new Point(container.Right - content.Width, container.Bottom - content.Height);
         case ContentAlignment.MiddleLeft: return new Point(0, container.VerticalCenter() - content.Height / 2);
         case ContentAlignment.MiddleCenter: return new Point(container.HorizontalCenter() - content.Width / 2, container.VerticalCenter() - content.Height / 2);
         case ContentAlignment.MiddleRight: return new Point(container.Right - content.Width, container.VerticalCenter() - content.Height / 2);
         case ContentAlignment.TopLeft: return container.Location;
         case ContentAlignment.TopCenter: return new Point(container.HorizontalCenter() - content.Width / 2, container.Top);
         case ContentAlignment.TopRight: return new Point(container.Right - content.Width, container.Top);
     }
     throw new InvalidEnumArgumentException();
 }