private static float GetLocationX(AlignmentH alignment, RectangleF boxBounds, RectangleF textBounds) { switch (alignment) { case AlignmentH.Left: return(boxBounds.X - textBounds.X); case AlignmentH.Right: return(boxBounds.X - textBounds.X + boxBounds.Width - textBounds.Width); case AlignmentH.Center: return(boxBounds.X - textBounds.X + boxBounds.Width / 2 - textBounds.Width / 2); default: throw new ArgumentOutOfRangeException(nameof(alignment)); } }
private static HorizontalAlignment ConvertHorizontalAlignment(AlignmentH alignment) { switch (alignment) { case AlignmentH.Left: return(HorizontalAlignment.Left); case AlignmentH.Right: return(HorizontalAlignment.Right); case AlignmentH.Center: return(HorizontalAlignment.Center); default: throw new ArgumentOutOfRangeException(nameof(alignment)); } }
public LayoutPosition() { screen = Screen.center; alignHorizontal = AlignmentH.stretch; alignVertical = AlignmentV.stretch; }