Ejemplo n.º 1
0
        private static int CalculateStartPosition(string text, HorizontalAlignment horizontalAlignment)
        {
            AlignedText alignedText = new AlignedText
            {
                Text = text,
                HorizontalAlignment = horizontalAlignment,
                Width = Console.BufferWidth
            };

            return(alignedText.SpaceLeftCount);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Aligns a text, in the specified width as is specified by the horizontalAlignemnt value.
        /// </summary>
        public static string QuickAlign(string text, HorizontalAlignment horizontalAlignment, int width)
        {
            AlignedText alignedText = new AlignedText
            {
                Text = text,
                HorizontalAlignment = horizontalAlignment,
                Width = width
            };

            return(alignedText.ToString());
        }