StdPaint.ConsoleBuffer.DrawLine C# (CSharp) Method

DrawLine() public method

Draws a line to the buffer with the specified brush.
public DrawLine ( Point a, Point b, BufferBrush brush ) : void
a Point The starting point of the line.
b Point The ending point of the line.
brush BufferBrush The brush to draw the line with.
return void
        public void DrawLine(Point a, Point b, BufferBrush brush)
        {
            DrawLine(a.X, a.Y, b.X, b.Y, brush);
        }

Same methods

ConsoleBuffer::DrawLine ( Point a, Point b, BufferColor color ) : void
ConsoleBuffer::DrawLine ( int x, int y, int x2, int y2, BufferBrush brush ) : void
ConsoleBuffer::DrawLine ( int x, int y, int x2, int y2, BufferColor color ) : 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::DrawLine