DrawBox() публичный Метод

Draws a box from the specified rectangle and brush information.
public DrawBox ( Rectangle rectangle, int thickness, BufferBrush border, BufferBrush fill ) : void
rectangle Rectangle The bounds of the box to draw.
thickness int The border thickness of the box.
border BufferBrush the border brush of the box.
fill BufferBrush The fill brush of the box.
Результат void
Пример #1
0
        /// <summary>
        /// Draws the display to the specified buffer.
        /// </summary>
        /// <param name="buffer">The buffer to draw to.</param>
        /// <param name="alignment">The alignment of the display to the draw position.</param>
        public void Draw(ConsoleBuffer buffer, Alignment alignment = Alignment.Left)
        {
            Point loc  = this.Location;
            Point dloc = loc;
            int   ox   = alignment == Alignment.Right ? _digitsUsed * 5 - 1 : -1;

            buffer.DrawBox(loc.X - ox, loc.Y, _digitsUsed * 5 - 1, 7, this.BackBrush);
            for (int i = 0; i < _digitsUsed; i++)
            {
                dloc.X = loc.X + i * 5 - ox;

                // Draw negative sign
                if (_value < 0 && i == 0)
                {
                    buffer.DrawLine(segments[3][0] + dloc, segments[3][1] + dloc, this.ForeBrush);
                    continue;
                }

                // Draw digit
                foreach (int j in layouts[_digits[i]])
                {
                    buffer.DrawLine(segments[j][0] + dloc, segments[j][1] + dloc, this.ForeBrush);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Draws the display to the specified buffer.
        /// </summary>
        /// <param name="buffer">The buffer to draw to.</param>
        /// <param name="alignment">The alignment of the display to the draw position.</param>
        public void Draw(ConsoleBuffer buffer, Alignment alignment = Alignment.Left)
        {
            Point loc = this.Location;
            Point dloc = loc;
            int ox = alignment == Alignment.Right ? _digitsUsed * 5 - 1 : -1;
            buffer.DrawBox(loc.X - ox, loc.Y, _digitsUsed * 5 - 1, 7, this.BackBrush);
            for(int i = 0; i < _digitsUsed; i++)
            {
                dloc.X = loc.X + i * 5 - ox;

                // Draw negative sign
                if (_value < 0 && i == 0)
                {
                    buffer.DrawLine(segments[3][0] + dloc, segments[3][1] + dloc, this.ForeBrush);
                    continue;
                }

                // Draw digit
                foreach(int j in layouts[_digits[i]])
                {
                    buffer.DrawLine(segments[j][0] + dloc, segments[j][1] + dloc, this.ForeBrush);
                }
            }
        }