private static int CalculateStartPosition(string text, HorizontalAlignment horizontalAlignment) { AlignedText alignedText = new AlignedText { Text = text, HorizontalAlignment = horizontalAlignment, Width = Console.BufferWidth }; return(alignedText.SpaceLeftCount); }
/// <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()); }