PolyLineSegment Class
.NET Framework 3.0
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
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
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" > <Path.Data> <PathGeometry> <PathGeometry.Figures> <PathFigure StartPoint="10,50"> <PathFigure.Segments> <BezierSegment Point1="100,0" Point2="200,200" Point3="300,100"/> <LineSegment Point="400,100" /> <ArcSegment Size="50,50" RotationAngle="45" IsLargeArc="True" SweepDirection="Clockwise" Point="200,100"/> </PathFigure.Segments> </PathFigure> <PathFigure StartPoint="10,100"> <PathFigure.Segments> <PolyLineSegment Points="50,100 50,150" /> <QuadraticBezierSegment Point1="200,200" Point2="300,100"/> </PathFigure.Segments> </PathFigure> </PathGeometry.Figures> </PathGeometry> </Path.Data> </Path>
PathGeometry myPathGeometry = new PathGeometry(); // Create a figure. PathFigure pathFigure1 = new PathFigure(); pathFigure1.StartPoint = new Point(10,50); pathFigure1.Segments.Add( new BezierSegment( new Point(100,0), new Point(200,200), new Point(300,100), true /* IsStroked */ )); pathFigure1.Segments.Add( new LineSegment( new Point(400,100), true /* IsStroked */ )); pathFigure1.Segments.Add( new ArcSegment( new Point(200,100), new Size(50,50), 45, true, /* IsLargeArc */ SweepDirection.Clockwise, true /* IsStroked */ )); myPathGeometry.Figures.Add(pathFigure1); // 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); pathFigure2.Segments.Add(myPolyLineSegment); pathFigure2.Segments.Add( new QuadraticBezierSegment( new Point(200,200), new Point(300,100), true /* IsStroked */ )); myPathGeometry.Figures.Add(pathFigure2); // Display the PathGeometry. Path myPath = new Path(); myPath.Stroke = Brushes.Black; myPath.StrokeThickness = 1; myPath.Data = myPathGeometry;
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.Community Additions
ADD
Show: