예제 #1
0
        public bool WriteTextBox(Rectangle textArea, string text, FrameDefinition frameDef)
        {
            int boxWidth  = textArea.Width;
            int boxHeight = textArea.Height;

            this.LimitBoxDimensions(textArea.X, textArea.Y, ref boxWidth, ref boxHeight);
            Debug.Assert(boxWidth >= 3);
            Debug.Assert(boxHeight >= 3);
            this.WriteTextBoxFrame(textArea.X, textArea.Y, boxWidth, boxHeight, frameDef);
            return(this.WriteTextBox(textArea.X + 1, textArea.Y + 1, boxWidth - 2, boxHeight - 2, text, frameDef.TextColor));
        }
예제 #2
0
        private void WriteTextBoxFrame(int boxX, int boxY, int boxWidth, int boxHeight, FrameDefinition frameDef)
        {
            this._console.SetColors(frameDef.FrameColor.ForeColor, frameDef.FrameColor.BgColor);
            this._console.PositionCursor(boxX, boxY);
            this._console.WriteText(frameDef.TopLeft);
            for (int i = 1; i < boxWidth - 1; i++)
            {
                this._console.WriteText(frameDef.Top);
            }
            this._console.WriteText(frameDef.TopRight);
            string body = frameDef.Left + new string(frameDef.BackgroundFiller, boxWidth - 2) + frameDef.Right;

            for (int j = 1; j < boxHeight - 1; j++)
            {
                this._console.PositionCursor(boxX, boxY + j);
                this._console.WriteText(body);
            }
            this._console.PositionCursor(boxX, boxY + boxHeight - 1);
            this._console.WriteText(frameDef.BottomLeft);
            for (int i = 1; i < boxWidth - 1; i++)
            {
                this._console.WriteText(frameDef.Bottom);
            }
            this._console.WriteText(frameDef.BottomRight);
        }