Esempio n. 1
0
        /// <summary>
        /// Redraws the text box, overrideable
        /// </summary>
        public override void Draw()
        {
            //Field
            int i, x;

            for (x = bounds.x; x < bounds.x + bounds.width; x++)
            {
                ConsoleBase.cbuf[x, bounds.y].SetBuffer(cfg, cbg, ' ');
            }
            //Text
            i = idx - bounds.width + 1;
            if (i < 0)
            {
                i = 0;
            }
            for (x = bounds.x; i < idx; i++, x++)
            {
                ConsoleBase.cbuf[x, bounds.y].SetBuffer(cfg, cbg, data[i]);
            }
            //Cursor if focused
            if (focused)
            {
                ConsoleBase.cbuf[x, bounds.y].SetBuffer(cfg, cbg, '_');
            }
            ConsoleBase.Draw(bounds);
        }
Esempio n. 2
0
 static void DrawCur()
 {
     buf.SetBuffer(ConsoleBase.cbuf[x, y].fg, ConsoleBase.cbuf[x, y].bg, ConsoleBase.cbuf[x, y].ch);
     ConsoleBase.cbuf[x, y].bg = ConsoleColor.DarkYellow;
     ConsoleBase.cbuf[x, y].dr = true;
     ConsoleBase.Draw(x, y, 1, 1);
 }
Esempio n. 3
0
        /// <summary>
        /// Redraws the list box, overrideable
        /// </summary>
        public override void Draw()
        {
            string tmp;

            for (int s = scr, y = bounds.y; y < bounds.y + bounds.height; y++, s++)
            {
                tmp = items[s].PadRight(bounds.width - 1);
                if (s == idx)
                {
                    for (int i = 0, x = bounds.x; i < tmp.Length; i++, x++)
                    {
                        ConsoleBase.cbuf[x, y].SetBuffer(sfg, sbg, tmp[i]);
                    }
                }
                else
                {
                    for (int i = 0, x = bounds.x; i < tmp.Length; i++, x++)
                    {
                        ConsoleBase.cbuf[x, y].SetBuffer(fg, bg, tmp[i]);
                    }
                }
                ConsoleBase.cbuf[bounds.x + bounds.width - 1, y].SetBuffer(fg, bg, '█');
            }
            ConsoleBase.cbuf[bounds.x + bounds.width - 1, bounds.y].SetBuffer(cfg, cbg, up_a);
            ConsoleBase.cbuf[bounds.x + bounds.width - 1, bounds.y + bounds.height - 1].SetBuffer(cfg, cbg, dw_a);
            ConsoleBase.Draw(bounds);
        }
Esempio n. 4
0
        /// <summary>
        /// Redraws the form and all of its controls
        /// </summary>
        public override void Draw()
        {
            base.Draw();
            uint br = (uint)border - 1;
            uint sh = (uint)shadow - 1;

            //Draw form
            if (border != BorderStyle.None)
            {
                for (int y = bounds.y + 1; y < bounds.y + 1 + bounds.height - 1; y++)
                {
                    ConsoleBase.cbuf[bounds.x, y].SetBuffer(fg, bg, fr[br, 1]);
                    ConsoleBase.cbuf[bounds.x + bounds.width - 1, y].SetBuffer(fg, bg, fr[br, 1]);
                }
                //Borders
                Console.SetCursorPosition(bounds.x, bounds.y);
                for (int x = bounds.x; x < bounds.x + bounds.width; x++)
                {
                    ConsoleBase.cbuf[x, bounds.y].SetBuffer(fg, bg, fr[br, 0]);
                }
                for (int x = bounds.x; x < bounds.x + bounds.width; x++)
                {
                    ConsoleBase.cbuf[x, bounds.y + bounds.height - 1].SetBuffer(fg, bg, fr[br, 0]);
                }
                //Corners
                ConsoleBase.cbuf[bounds.x, bounds.y].SetBuffer(fg, bg, fr[br, 2]);
                ConsoleBase.cbuf[bounds.x + bounds.width - 1, bounds.y].SetBuffer(fg, bg, fr[br, 3]);
                ConsoleBase.cbuf[bounds.x, bounds.y + bounds.height - 1].SetBuffer(fg, bg, fr[br, 4]);
                ConsoleBase.cbuf[bounds.x + bounds.width - 1, bounds.y + bounds.height - 1].SetBuffer(fg, bg, fr[br, 5]);
            }
            //Title
            if (text != null && text.Length > 0)
            {
                for (int i = 0, x = (bounds.x + bounds.x + bounds.width) / 2 - text.Length / 2; i < text.Length; i++, x++)
                {
                    ConsoleBase.cbuf[x, bounds.y].SetBuffer(tfg, bg, text[i]);
                }
            }
            //Shadow
            if (shadow != ShadowStyle.None)
            {
                for (int y = bounds.y + 1; y < bounds.y + 1 + bounds.height; y++)
                {
                    ConsoleBase.cbuf[bounds.x + bounds.width, y].SetBuffer(sfg, sbg, sw[sh]);
                }
                for (int x = bounds.x + 1; x < bounds.x + 1 + bounds.width; x++)
                {
                    ConsoleBase.cbuf[x, bounds.y + bounds.height].SetBuffer(sfg, sbg, sw[sh]);
                }
            }
            //Draw controls
            foreach (Control c in controls)
            {
                if (c.visible)
                {
                    c.Draw();
                }
            }
            ConsoleBase.Draw(bounds.x, bounds.y, bounds.width + 1, bounds.height + 1);
        }
Esempio n. 5
0
        /// <summary>
        /// Redraws the control, overrideable
        /// </summary>
        public override void Draw()
        {
            string tmp = text.PadRight(bounds.width);

            for (int i = 0, x = bounds.x; i < tmp.Length; i++, x++)
            {
                ConsoleBase.cbuf[x, bounds.y].SetBuffer(cfg, cbg, tmp[i]);
            }
            ConsoleBase.Draw(bounds);
        }
Esempio n. 6
0
        /// <summary>
        /// Redraws the check box, overrideable
        /// </summary>
        public override void Draw()
        {
            string tmp = ("[" + (check ? "X" : " ") + "] " + text).PadRight(bounds.width);

            for (int i = 0, x = bounds.x; i < tmp.Length; i++, x++)
            {
                ConsoleBase.cbuf[x, bounds.y].SetBuffer(cfg, cbg, tmp[i]);
            }
            for (int x = bounds.x; x < bounds.width; x++)
            {
                ConsoleBase.cbuf[x, y].SetBuffer(cfg, cbg, ' ');
            }
            ConsoleBase.Draw(bounds);
        }
Esempio n. 7
0
        /// <summary>
        /// Redraws the progress bar, overrideable
        /// </summary>
        public override void Draw()
        {
            int tmp = (int)(bounds.width * ((float)val / (max - min)));

            for (int i = 0; i < tmp; i++)
            {
                ConsoleBase.cbuf[bounds.x + i, bounds.y].SetBuffer(sfg, sbg, ' ');
            }
            for (int i = tmp; i < bounds.width; i++)
            {
                ConsoleBase.cbuf[bounds.x + i, bounds.y].SetBuffer(fg, bg, ' ');
            }
            ConsoleBase.Draw(bounds);
        }
Esempio n. 8
0
 /// <summary>
 /// Draws the container
 /// </summary>
 public override void Draw()
 {
     for (int y = bounds.y; y < bounds.y + bounds.height; y++)
     {
         for (int x = bounds.x; x < bounds.x + bounds.width; x++)
         {
             ConsoleBase.cbuf[x, y].fg = fg;
             ConsoleBase.cbuf[x, y].bg = bg;
             ConsoleBase.cbuf[x, y].ch = ' ';
             ConsoleBase.cbuf[x, y].dr = true;
         }
     }
     //Draw controls
     foreach (Control c in controls)
     {
         if (c.visible)
         {
             c.Draw();
         }
     }
     ConsoleBase.Draw(bounds.x, bounds.y, bounds.width, bounds.height);
 }
Esempio n. 9
0
 static void DrawBuff()
 {
     ConsoleBase.cbuf[x, y].SetBuffer(buf.fg, buf.bg, buf.ch);
     ConsoleBase.Draw(x, y, 1, 1);
 }