Beispiel #1
0
        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));
            }
        }
Beispiel #2
0
        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));
            }
        }
Beispiel #3
0
 public LayoutPosition()
 {
     screen          = Screen.center;
     alignHorizontal = AlignmentH.stretch;
     alignVertical   = AlignmentV.stretch;
 }