Class Line
public class Line : View, IDisposable, ISupportInitializeNotification, ISupportInitialize, IOrientation
- Inheritance
-
Line
- Implements
- Inherited Members
Examples
// Create a horizontal line
var hLine = new Line { Y = 5 };
// Create a vertical line with specific length
var vLine = new Line { X = 10, Orientation = Orientation.Vertical, Length = 15 };
// Create a double-line style horizontal line
var doubleLine = new Line { Y = 10, Style = LineStyle.Double };
Remarks
Line is a View that renders a single horizontal or vertical line using the LineCanvas system. Line integrates with the LineCanvas to enable proper box-drawing character selection and line intersection handling.
The line's appearance is controlled by the Style property, which supports various line styles including Single, Double, Heavy, Rounded, Dashed, and Dotted.
Use the Length property to control the extent of the line regardless of its Orientation. For horizontal lines, Length controls Width; for vertical lines, it controls Height. The perpendicular dimension is always 1.
When multiple Line instances or other LineCanvas-aware views (like Border) intersect, the LineCanvas automatically selects the appropriate box-drawing characters for corners, T-junctions, and crosses.
Line sets SuperViewRendersLineCanvas to true, meaning its parent view is responsible for rendering the line. This allows for proper intersection handling when multiple views contribute lines to the same canvas.
Constructors
Properties
- Length
Gets or sets the length of the line along its orientation.
- Orientation
The direction of the line.
- Style
Gets or sets the style of the line. This controls the visual appearance of the line.
Methods
- OnDrawingContent()
Called when the View's content is to be drawn. The default implementation does nothing.
- OnHeightChanging(ValueChangingEventArgs<Dim>)
Called before the Height property changes, allowing subclasses to cancel or modify the change.
- OnOrientationChanged(Orientation)
Called when Orientation has changed.
- OnWidthChanging(ValueChangingEventArgs<Dim>)
Called before the Width property changes, allowing subclasses to cancel or modify the change.
Events
- OrientationChanged
Raised when Orientation has changed.
- OrientationChanging
Raised when Orientation is changing. Can be cancelled.