public DrawBox ( |
||
rectangle | The bounds of the box to draw. | |
thickness | int | The border thickness of the box. |
border | the border brush of the box. | |
fill | The fill brush of the box. | |
return | void |
/// <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); } } }
/// <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); } } }