Bagikan melalui


PolyBezierSegment.Points Properti

Definisi

Mendapatkan atau mengatur PointCollection yang menentukan objek ini PolyBezierSegment .

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

Nilai Properti

Koleksi yang menentukan objek ini PolyBezierSegment .

Contoh

Contoh berikut menunjukkan cara menggunakan Points properti dari yang PolyBezierSegment mendefinisikan dua kurva Bezier kubik.

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <StackPanel>
    <Canvas>
      <Path Stroke="Black" StrokeThickness="1">
        <Path.Data>
          <PathGeometry>
            <PathGeometry.Figures>
              <PathFigureCollection>

                <!-- The StartPoint specifies the starting point of the first curve. -->
                <PathFigure StartPoint="10,100">
                  <PathFigure.Segments>
                    <PathSegmentCollection>

                      <!-- The PolyBezierSegment specifies two cubic Bezier curves.
                           The first curve is from 10,100 (start point specified above)
                           to 300,100 with a control point of 0,0 and another control
                           point of 200,0. The second curve is from 300,100 
                           (end of the last curve) to 600,100 with a control point of 300,0
                           and another control point of 400,0. -->
                      <PolyBezierSegment Points="0,0 200,0 300,100 300,0 400,0 600,100" />
                    </PathSegmentCollection>
                  </PathFigure.Segments>
                </PathFigure>
              </PathFigureCollection>
            </PathGeometry.Figures>
          </PathGeometry>
        </Path.Data>
      </Path>
    </Canvas>
  </StackPanel>
</Page>
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;

namespace SDKSample
{
    public partial class PolyBezierSegmentExample : Page
    {
        public PolyBezierSegmentExample()
        {

            // Create a PathFigure to be used for the PathGeometry of myPath.
            PathFigure myPathFigure = new PathFigure();

            // Set the starting point for the PathFigure specifying that the
            // geometry starts at point 10,100.
            myPathFigure.StartPoint = new Point(10, 100);

            // Create a PointCollection that holds the Points used to specify 
            // the points of the PolyBezierSegment below.
            PointCollection myPointCollection = new PointCollection(6);
            myPointCollection.Add(new Point(0, 0));
            myPointCollection.Add(new Point(200, 0));
            myPointCollection.Add(new Point(300, 100));
            myPointCollection.Add(new Point(300, 0));
            myPointCollection.Add(new Point(400, 0));
            myPointCollection.Add(new Point(600, 100));

            // The PolyBezierSegment specifies two cubic Bezier curves.
            // The first curve is from 10,100 (start point specified by the PathFigure)
            // to 300,100 with a control point of 0,0 and another control point 
            // of 200,0. The second curve is from 300,100 (end of the last curve) to 
            // 600,100 with a control point of 300,0 and another control point of 400,0.
            PolyBezierSegment myBezierSegment = new PolyBezierSegment();
            myBezierSegment.Points = myPointCollection;

            PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
            myPathSegmentCollection.Add(myBezierSegment);

            myPathFigure.Segments = myPathSegmentCollection;

            PathFigureCollection myPathFigureCollection = new PathFigureCollection();
            myPathFigureCollection.Add(myPathFigure);

            PathGeometry myPathGeometry = new PathGeometry();
            myPathGeometry.Figures = myPathFigureCollection;

            // Create a path to draw a geometry with.
            Path myPath = new Path();
            myPath.Stroke = Brushes.Black;
            myPath.StrokeThickness = 1;

            // specify the shape (quadratic Bezier curve) of the path using the StreamGeometry.
            myPath.Data = myPathGeometry;

            // Add path shape to the UI.
            StackPanel mainPanel = new StackPanel();
            mainPanel.Children.Add(myPath);
            this.Content = mainPanel;
        }
    }
}

Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media
Imports System.Windows.Shapes

Namespace SDKSample
    Partial Public Class PolyBezierSegmentExample
        Inherits Page
        Public Sub New()

            ' Create a PathFigure to be used for the PathGeometry of myPath.
            Dim myPathFigure As New PathFigure()

            ' Set the starting point for the PathFigure specifying that the
            ' geometry starts at point 10,100.
            myPathFigure.StartPoint = New Point(10, 100)

            ' Create a PointCollection that holds the Points used to specify 
            ' the points of the PolyBezierSegment below.
            Dim myPointCollection As New PointCollection(6)
            myPointCollection.Add(New Point(0, 0))
            myPointCollection.Add(New Point(200, 0))
            myPointCollection.Add(New Point(300, 100))
            myPointCollection.Add(New Point(300, 0))
            myPointCollection.Add(New Point(400, 0))
            myPointCollection.Add(New Point(600, 100))

            ' The PolyBezierSegment specifies two cubic Bezier curves.
            ' The first curve is from 10,100 (start point specified by the PathFigure)
            ' to 300,100 with a control point of 0,0 and another control point 
            ' of 200,0. The second curve is from 300,100 (end of the last curve) to 
            ' 600,100 with a control point of 300,0 and another control point of 400,0.
            Dim myBezierSegment As New PolyBezierSegment()
            myBezierSegment.Points = myPointCollection

            Dim myPathSegmentCollection As New PathSegmentCollection()
            myPathSegmentCollection.Add(myBezierSegment)

            myPathFigure.Segments = myPathSegmentCollection

            Dim myPathFigureCollection As New PathFigureCollection()
            myPathFigureCollection.Add(myPathFigure)

            Dim myPathGeometry As New PathGeometry()
            myPathGeometry.Figures = myPathFigureCollection

            ' Create a path to draw a geometry with.
            Dim myPath As New Path()
            myPath.Stroke = Brushes.Black
            myPath.StrokeThickness = 1

            ' specify the shape (quadratic Bezier curve) of the path using the StreamGeometry.
            myPath.Data = myPathGeometry

            ' Add path shape to the UI.
            Dim mainPanel As New StackPanel()
            mainPanel.Children.Add(myPath)
            Me.Content = mainPanel
        End Sub
    End Class
End Namespace

Keterangan

Informasi Properti Dependensi

Bidang pengidentifikasi PointsProperty
Properti metadata diatur ke true Tidak ada

Berlaku untuk