protected override void OnRender(ControlRenderInfo cri) { string finalText = (new string(' ', Padding) + Text).PadRight(cri.Width); System.Console.BackgroundColor = Selected ? SelectedBackColor : BackColor; System.Console.ForegroundColor = Selected ? SelectedForeColor : ForeColor; System.Console.Write(finalText); System.Console.BackgroundColor = ParentMenu.BackColor; System.Console.ForegroundColor = ParentMenu.ForeColor; }
protected override void OnRender(ControlRenderInfo cri) { string text = Value.ToString(Format).Clamp(cri.Width - Padding * 2 - 2); string finalText = (((new string(' ', Padding) + '<').PadRight(cri.Width / 2 - text.Length / 2) + text).PadRight(cri.Width - Padding - 1) + '>').PadRight(cri.Width); // Really ugly code System.Console.BackgroundColor = Selected ? SelectedBackColor : BackColor; System.Console.ForegroundColor = Selected ? SelectedForeColor : ForeColor; System.Console.Write(finalText); System.Console.BackgroundColor = ParentMenu.BackColor; System.Console.ForegroundColor = ParentMenu.ForeColor; }
protected abstract void OnRender(ControlRenderInfo cri);
/// <summary> /// Renders this control /// </summary> /// <param name="cri">The control render info</param> public void Render(ControlRenderInfo cri) { System.Console.CursorLeft = 0; System.Console.CursorTop = cri.Line; OnRender(cri); }