} // proc Set public void Fill(int left, int top, int right, int bottom, char fill, ConsoleColor foreground = ConsoleColor.Gray, ConsoleColor background = ConsoleColor.Black) { var attr = ConsoleOutputBuffer.GetCharAttributes(foreground, background); for (var y = top; y <= bottom; y++) { for (var x = left; x <= right; x++) { chars[y, x].Char = fill; chars[y, x].Attributes = attr; } } } // proc Fill
} // proc Fill public (int endLeft, int endTop) Write(int left, int top, string value, int?lineBreakTo = null, ConsoleColor foreground = ConsoleColor.Gray, ConsoleColor background = ConsoleColor.Black) { if (String.IsNullOrEmpty(value)) { return(left, top); } var attr = ConsoleOutputBuffer.GetCharAttributes(foreground, background); var y = top; var x = left; var l = value.Length; for (var i = 0; i < l; i++) { if (x >= Width) { if (lineBreakTo.HasValue) { y++; x = lineBreakTo.Value; } else { return(x, y); } } if (y >= Height) { return(x, y); } chars[y, x].Char = value[i]; chars[y, x].Attributes = attr; x++; } return(x, y); } // proc Write