PolyBezierSegment.Points 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定 PointCollection,它會定義這個 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
屬性值
定義這個 PolyBezierSegment 物件的集合。
範例
下列範例示範如何使用 Points 定義兩個立方 Bezier 曲線的 PolyBezierSegment 屬性。
<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
備註
相依性屬性資訊
識別碼欄位 | PointsProperty |
設定為 的中繼資料屬性 true |
無 |