Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
 protected abstract void OnRender(ControlRenderInfo cri);
Ejemplo n.º 4
0
 /// <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);
 }