public void Write <T>(T text, ExtendedConsoleColor Foreground, ExtendedConsoleColor Background) { var s = text.ToString().ToCharArray(); if (matrix == null) { throw new InvalidOperationException("You must cannot write now. You must initial with BeginWrite() first!"); } var m = matrix; for (int i = 0; i < s.Length; ++i) { var c = m[WriterLeft, WriterTop]; c.Background = Background; c.Foreground = Foreground; c.Value = s[i]; WriterLeft++; if (WriterLeft >= X + Width) { WriterLeft = X; WriterTop++; if (WriterTop >= Y + Height) { WriterTop = Y; } } } }
public override void Draw(Out.ClipWriterAsync writer) { base.Draw(writer); ExtendedConsoleColor tc = TextColor, tb = TextBackground, bc = BoundColor, bb = BoundBackground; writer.SetWriterRelPos(0, 0); writer.Write(doubleBounds ? '╔' : '┌', bc, bb); writer.Write(new string(doubleBounds ? '═' : '─', Width - 2), bc, bb); writer.Write(doubleBounds ? '╗' : '┐', bc, bb); writer.SetWriterRelPos(0, 1); writer.Write(doubleBounds ? '║' : '|', bc, bb); writer.Write(new string(' ', (Width - 2 - text.Length) / 2), tc, tb); writer.Write(text, tc, tb); writer.Write(new string(' ', (Width - 2 - text.Length) - (Width - 2 - text.Length) / 2), tc, tb); writer.Write(doubleBounds ? '║' : '|', bc, bb); writer.SetWriterRelPos(0, 2); writer.Write(doubleBounds ? '╚' : '└', bc, bb); writer.Write(new string(doubleBounds ? '═' : '─', Width - 2), bc, bb); writer.Write(doubleBounds ? '╝' : '┘', bc, bb); }
public void Write <T>(T text, ExtendedConsoleColor Foreground, ExtendedConsoleColor Background) { var s = text.ToString().ToCharArray(); var m = matrix == null ? Owner.Matrix : matrix; for (int i = 0; i < s.Length; ++i) { var c = m[WriterLeft, WriterTop]; c.Background = Background; c.Foreground = Foreground; c.Value = s[i]; WriterLeft++; if (WriterLeft >= m.Width) { WriterLeft = 0; WriterTop++; if (WriterTop >= m.Height) { WriterTop = 0; } } } }
public Button() { TextColor = BoundColor = System.Drawing.Color.White; TextBackground = BoundBackground = System.Drawing.Color.Black; }