Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
PolyLineSegment Class
Collapse the table of content
Expand the table of content

PolyLineSegment Class

Represents a set of line segments defined by a PointCollection with each Point specifying the end point of a line segment.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public sealed class PolyLineSegment : PathSegment
public final class PolyLineSegment extends PathSegment
public final class PolyLineSegment extends PathSegment
<PolyLineSegment .../>

Use this class to create a series of connected lines in a PathFigure.

The following example shows how to use a PolyLineSegment to specify points for segments of a PathFigure.

<Path Stroke="Black" StrokeThickness="1" >
        <PathFigure StartPoint="10,50">
            <LineSegment Point="400,100" />
              Size="50,50" RotationAngle="45"
              IsLargeArc="True" SweepDirection="Clockwise"
        <PathFigure StartPoint="10,100">
            <PolyLineSegment Points="50,100 50,150" />
            <QuadraticBezierSegment Point1="200,200" Point2="300,100"/>

PathGeometry myPathGeometry = new PathGeometry();            

// Create a figure.
PathFigure pathFigure1 = new PathFigure();
pathFigure1.StartPoint = new Point(10,50);
    new BezierSegment(
        new Point(100,0),
        new Point(200,200),
        new Point(300,100),
        true /* IsStroked */ )); 
    new LineSegment(
        new Point(400,100),
        true /* IsStroked */ ));
    new ArcSegment(
        new Point(200,100),
        new Size(50,50),
        true, /* IsLargeArc */
        true /* IsStroked */ ));

// Create another figure.
PathFigure pathFigure2 = new PathFigure();
pathFigure2.StartPoint = new Point(10,100);
Point[] polyLinePointArray = 
    new Point[]{ new Point(50, 100), new Point(50, 150)};
PolyLineSegment myPolyLineSegment = new PolyLineSegment();
myPolyLineSegment.Points = 
    new PointCollection(polyLinePointArray);
    new QuadraticBezierSegment(
        new Point(200,200),
        new Point(300,100),
        true /* IsStroked */ ));

// Display the PathGeometry. 
Path myPath = new Path();
myPath.Stroke = Brushes.Black;
myPath.StrokeThickness = 1;
myPath.Data = myPathGeometry;

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2015 Microsoft