示例#1
0
        public void HLine(Point startPosition, int length, TextCell cell)
        {
            if (length < 1 || startPosition.Y < 0 || startPosition.Y >= Size.Height)
            {
                return;
            }

            for (int i = 0; i < length; i++) // TODO: needs optimization
            {
                Write(startPosition.AddToX(i), cell);
            }
        }
示例#2
0
        private void WriteLine(Point position, string message, Color16 foreColor, Color16 backColor)
        {
            if (Size.AsRectangle.Contains(position.JustY) == false)
            {
                return;
            }

            for (int i = 0; i < message.Length; i++) // TODO: can be optimized, no need to draw not visible characters
            {
                Point letterPosition = position.AddToX(i);

                if (letterPosition.X >= Size.Width)
                {
                    return;
                }

                Write(letterPosition, new TextCell(message[i], foreColor, backColor));
            }
        }
        //====== private methods

        private void WriteStatsLine(TextCanvas canvas, Point position, string key, string value, Color16 foreColor)
        {
            canvas.WriteText(position, key + ":", Color16.White, Appearance.BackColor);
            canvas.WriteText(position.AddToX(key.Length + 2), value, foreColor, Appearance.BackColor);
        }