Exemplo n.º 1
0
        public ConsoleElement(int x, int y, int w, int h, string text, ConsoleElementStyle style = ConsoleElementStyle.CENTER, ConsoleColor textColor = ConsoleColor.White, ConsoleColor bgColor = ConsoleColor.DarkGray)
        {
            this.x          = x;
            this.y          = y;
            this.w          = w;
            this.h          = h;
            this._bgColor   = bgColor;
            this._textColor = textColor;
            this.text       = text;
            if (style == ConsoleElementStyle.CENTER)
            {
                rez = new string(' ', (this.w - this.text.Length) / 2);
                rez = rez + text + rez;
            }
            else if (style == ConsoleElementStyle.RIGHT)
            {
                rez  = new string(' ', this.w - this.text.Length);
                rez += text;
            }
            else
            {
                rez = new string(' ', this.w - this.text.Length);
                rez = text + rez;
            }


            //this.deActive();
        }
Exemplo n.º 2
0
        public ConsoleElement(int x, int y, int w, int h, string text, ConsoleElementStyle style = ConsoleElementStyle.CENTER,ConsoleColor textColor=ConsoleColor.White,ConsoleColor bgColor=ConsoleColor.DarkGray)
        {
            this.x = x;
            this.y = y;
            this.w = w;
            this.h = h;
            this._bgColor = bgColor;
            this._textColor = textColor;
            this.text = text;
            if (style == ConsoleElementStyle.CENTER)
            {
                rez = new string(' ', (this.w - this.text.Length) / 2);
                rez = rez + text + rez;
            }
            else if (style == ConsoleElementStyle.RIGHT)
            {
                rez = new string(' ', this.w - this.text.Length);
                rez += text;
            }
            else
            {
                rez = new string(' ', this.w - this.text.Length);
                rez = text + rez;
            }

            //this.deActive();
        }