Search Results for

    Show / Hide Table of Contents

    Class LineSegment

    Path for a linear segment.

    Inheritance
    System.Object
    LineSegment
    Implements
    IronSoftware.Abstractions.ILineSegment
    IronSoftware.Abstractions.IPathSegment
    Namespace: IronWord.Models
    Assembly: IronWord.dll
    Syntax
    public class LineSegment : Object

    Drawing a straight edge of a custom shape outline in C# is described by a LineSegment. It records one linear leg of a path, the point it travels to and how it connects to the rest of the outline, so a sequence of segments traces the full geometry of a shape.

    A segment is created with a constructor that takes the target PointF, a flag for whether the segment closes the path, and a flag for whether it stands apart from the previous segment. Coordinate holds the point the line runs to, IsClose reports whether this segment connects back to the path start, and SeparateFromPrevious controls whether it joins the prior segment. Because LineSegment implements IPathSegment, it sits in a PathSegmentCollection alongside its curved counterpart, BezierSegment, and a renderer reads the collection in order to build the outline. Reach for LineSegment for the straight portions and BezierSegment where a curve is needed.

    var segment = new LineSegment(new PointF(120f, 0f), false, false);

    The document element tutorial covers how shapes and their parts fit into a document.

    Constructors

    LineSegment(PointF, Boolean, Boolean)

    Create a new line segment.

    Declaration
    public LineSegment(PointF coordinate, bool isClose = false, bool separateFromPrevious = true)
    Parameters
    Type Name Description
    System.Drawing.PointF coordinate

    The (x, y) coordinate of the end of the line segment.

    System.Boolean isClose

    Whether this line segment closes the path or not.

    System.Boolean separateFromPrevious

    Whether this line segment connects to the previous line segment or not.

    Properties

    Coordinate

    Coordinate of the line segment.

    Declaration
    public PointF Coordinate { get; set; }
    Property Value
    Type Description
    System.Drawing.PointF

    IsClose

    Whether this line segment connects back to the path start or not.

    Declaration
    public bool IsClose { get; set; }
    Property Value
    Type Description
    System.Boolean

    SeparateFromPrevious

    Whether this line segment connects to the previous line segment or not.

    Declaration
    public bool SeparateFromPrevious { get; set; }
    Property Value
    Type Description
    System.Boolean

    Implements

    IronSoftware.Abstractions.ILineSegment
    IronSoftware.Abstractions.IPathSegment
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet