StdPaint.ConsoleBuffer.DrawBox C# (CSharp) Method

DrawBox() public method

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.
return void
        public void DrawBox(Rectangle rectangle, int thickness, BufferBrush border, BufferBrush fill)
        {
            DrawBox(rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height, thickness, border, fill);
        }

Same methods

ConsoleBuffer::DrawBox ( int x, int y, int w, int h, BufferBrush brush ) : void
ConsoleBuffer::DrawBox ( int x, int y, int w, int h, BufferColor color ) : void
ConsoleBuffer::DrawBox ( int x, int y, int w, int h, int thickness, BufferBrush border, BufferBrush fill ) : void

Usage Example

Esempio n. 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);
                }
            }
        }
All Usage Examples Of StdPaint.ConsoleBuffer::DrawBox