Line.cs 892 B

12345678910111213141516171819202122232425
  1. namespace Terminal.Gui;
  2. /// <summary>Draws a single line using the <see cref="LineStyle"/> specified by <see cref="View.BorderStyle"/>.</summary>
  3. public class Line : View
  4. {
  5. /// <summary>Constructs a Line object.</summary>
  6. public Line () { }
  7. /// <summary>
  8. /// The direction of the line. If you change this you will need to manually update the Width/Height of the
  9. /// control to cover a relevant area based on the new direction.
  10. /// </summary>
  11. public Orientation Orientation { get; set; }
  12. /// <inheritdoc/>
  13. public override void OnDrawContent (Rectangle contentArea)
  14. {
  15. LineCanvas.AddLine (
  16. BoundsToScreen (contentArea).Location,
  17. Orientation == Orientation.Horizontal ? Frame.Width : Frame.Height,
  18. Orientation,
  19. BorderStyle
  20. );
  21. }
  22. }