PolyLineSegment.Points 屬性

定義

取得或設定定義這個 Point 物件之 PolyLineSegment 結構的集合。

public:
 property System::Windows::Media::PointCollection ^ Points { System::Windows::Media::PointCollection ^ get(); void set(System::Windows::Media::PointCollection ^ value); };
public System.Windows.Media.PointCollection Points { get; set; }
member this.Points : System.Windows.Media.PointCollection with get, set
Public Property Points As PointCollection

屬性值

這個 PolyLineSegment 物件的形狀。

範例

下列範例示範如何使用 Points 屬性來設定 的 PolyLineSegment 線段點。


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;

Dim myPathGeometry As New PathGeometry()

' Create a figure.
Dim pathFigure1 As 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, SweepDirection.Clockwise, True)) ' IsStroked  -  IsLargeArc 
myPathGeometry.Figures.Add(pathFigure1)

' Create another figure.
Dim pathFigure2 As New PathFigure()
pathFigure2.StartPoint = New Point(10,100)
Dim polyLinePointArray() As Point = { New Point(50, 100), New Point(50, 150)}
Dim myPolyLineSegment As 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. 
Dim myPath As New Path()
myPath.Stroke = Brushes.Black
myPath.StrokeThickness = 1
myPath.Data = myPathGeometry

備註

線條是從上一個區段的終點繪製,如果這是第一個線段,則從 StartPointPathFigure 的 繪製到這個集合中的第一個點。 然後,在此集合中指定的每個後續點之間繪製線條。

相依性屬性資訊

識別碼欄位 PointsProperty
設定為 的中繼資料屬性 true

適用於