PolyBezierSegment 類別

定義

表示一條或多條三次方貝茲曲線。

public ref class PolyBezierSegment sealed : System::Windows::Media::PathSegment
public sealed class PolyBezierSegment : System.Windows.Media.PathSegment
type PolyBezierSegment = class
    inherit PathSegment
Public NotInheritable Class PolyBezierSegment
Inherits PathSegment
繼承

範例

下列範例示範如何使用 PolyBezierSegment 來繪製兩個立方 Bezier 曲線。

<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

備註

PathFigure使用 物件來儲存 PolyBezierSegment 物件和其他區段。

三次方 Bezier 曲線是由四點所定義:一個起點、一個終點和兩個控制點。 指定 PolyBezierSegment 一或多個立方 Bezier 曲線,方法是將 Points 屬性設定為點集合。 針對集合中的每三個點,第一個和第二個點會指定曲線的兩個控制點,而第三個點則指定結束點。 請注意,沒有指定曲線的起點,因為起點與最後一個線段的終點相同。

三次方 Bezier 曲線的兩個控制點的行為就像磁力一樣,另一部分則為直線向自己,並產生曲線。 第一個控制點會影響曲線的開頭部分;第二個控制點會影響曲線的結束部分。 請注意,曲線不一定通過任一控制點;每個控制點都會將其行的部分向本身移動,但不會透過本身移動。

建構函式

PolyBezierSegment()

初始化 PolyBezierSegment 類別的新執行個體。

PolyBezierSegment(IEnumerable<Point>, Boolean)

初始化 PolyBezierSegment 類別的新執行個體,這個執行個體具有指定之 Point 物件的集合,以及指定是否將片段描邊的值。

欄位

PointsProperty

識別 Points 相依性屬性。

屬性

CanFreeze

取得值,指出是否可以將物件設為不可修改。

(繼承來源 Freezable)
DependencyObjectType

取得包裝 DependencyObjectType 這個實例 CLR 型別的 。

(繼承來源 DependencyObject)
Dispatcher

取得與這個 Dispatcher 關聯的 DispatcherObject

(繼承來源 DispatcherObject)
HasAnimatedProperties

取得值,這個值表示是否有一個或多個 AnimationClock 物件與這個物件的任何一個相依性屬性相關聯。

(繼承來源 Animatable)
IsFrozen

取得值,該值表示物件目前是否可修改。

(繼承來源 Freezable)
IsSealed

取得值,這個值表示此執行個體目前是否已密封 (唯讀)。

(繼承來源 DependencyObject)
IsSmoothJoin

取得或設定值,這個值表示使用 PathSegment 加上描邊時,是否將這個 PathSegment 與前一個 Pen 之間的聯結視為邊角。

(繼承來源 PathSegment)
IsStroked

取得或設定值,這個值表示是否將片段描邊。

(繼承來源 PathSegment)
Points

取得或設定 PointCollection,它會定義這個 PolyBezierSegment 物件。

方法

ApplyAnimationClock(DependencyProperty, AnimationClock)

AnimationClock 套用至指定的 DependencyProperty。 如果屬性已有動畫效果,即使用 SnapshotAndReplace 遞移式行為。

(繼承來源 Animatable)
ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)

AnimationClock 套用至指定的 DependencyProperty。 如果已建立屬性的動畫,則會使用指定的 HandoffBehavior

(繼承來源 Animatable)
BeginAnimation(DependencyProperty, AnimationTimeline)

將動畫套用至指定的 DependencyProperty。 呈現下一個畫面格後,就會啟動動畫。 如果指定的屬性已有動畫效果,即使用 SnapshotAndReplace 遞移式行為。

(繼承來源 Animatable)
BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)

將動畫套用至指定的 DependencyProperty。 呈現下一個畫面格後,就會啟動動畫。 如果已建立指定之屬性的動畫,則會使用指定的 HandoffBehavior

(繼承來源 Animatable)
CheckAccess()

判斷呼叫的執行是否可以存取這個 DispatcherObject

(繼承來源 DispatcherObject)
ClearValue(DependencyProperty)

清除屬性的區域數值。 要清除的屬性是由 DependencyProperty 識別項所指定。

(繼承來源 DependencyObject)
ClearValue(DependencyPropertyKey)

清除唯讀屬性的區域數值。 要清除的屬性是由 DependencyPropertyKey 所指定。

(繼承來源 DependencyObject)
Clone()

建立這個 PolyBezierSegment的可修改複製品,製作這個物件值的深層複本。 當複製相依性屬性時,這個方法會複製資源參考和資料繫結 (但可能無法再解析),但不會複製動畫或它們目前的值。

CloneCore(Freezable)

使用基底 (非動畫) 屬性值,將執行個體設為指定 Freezable 的複製品 (深層複製)。

(繼承來源 Freezable)
CloneCurrentValue()

建立這個 PolyBezierSegment 物件的可修改複製品,製作這個物件目前值的深層複本。 不會複製資源參考、資料繫結和動畫,但是會複製其目前值。

CloneCurrentValueCore(Freezable)

使用目前的屬性值,讓執行個體成為指定之 Freezable 的可修改複本 (深層複本)。

(繼承來源 Freezable)
CoerceValue(DependencyProperty)

強制轉型所指定相依性屬性的值。 完成方式是叫用存在於呼叫 DependencyObject 之相依性屬性的屬性中繼資料中所指定的任何 CoerceValueCallback 函式。

(繼承來源 DependencyObject)
CreateInstance()

初始化 Freezable 類別的新執行個體。

(繼承來源 Freezable)
CreateInstanceCore()

在衍生類別中實作時,建立 Freezable 衍生類別的新執行個體。

(繼承來源 Freezable)
Equals(Object)

判斷提供的 DependencyObject 和目前的 DependencyObject 是否相等。

(繼承來源 DependencyObject)
Freeze()

將目前的物件設為不可修改,並將其 IsFrozen 屬性設定為 true

(繼承來源 Freezable)
FreezeCore(Boolean)

將這個 Animatable 物件設定為不可修改,或決定是否可以將它設定為不可修改。

(繼承來源 Animatable)
GetAnimationBaseValue(DependencyProperty)

傳回指定之 DependencyProperty 的非動畫實值。

(繼承來源 Animatable)
GetAsFrozen()

使用基底 (非動畫) 屬性值,建立 Freezable 的凍結複本。 因為複本已凍結,所以會以傳址方式複製任何凍結子物件。

(繼承來源 Freezable)
GetAsFrozenCore(Freezable)

使用基底 (非動畫) 屬性值,將執行個體設為指定 Freezable 的凍結複本。

(繼承來源 Freezable)
GetCurrentValueAsFrozen()

使用目前屬性值,建立 Freezable 的凍結複本。 因為複本已凍結,所以會以傳址方式複製任何凍結子物件。

(繼承來源 Freezable)
GetCurrentValueAsFrozenCore(Freezable)

將目前執行個體設為所指定 Freezable 的凍結複本。 如果物件具有動畫相依性屬性,則會複製其目前的動畫值。

(繼承來源 Freezable)
GetHashCode()

取得這個 DependencyObject 的雜湊碼。

(繼承來源 DependencyObject)
GetLocalValueEnumerator()

建立特定的列舉值,以判斷哪些相依性屬性在此 DependencyObject 上具有本機設定的值。

(繼承來源 DependencyObject)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
GetValue(DependencyProperty)

傳回 DependencyObject 的這個執行個體上之相依性屬性的目前有效值。

(繼承來源 DependencyObject)
InvalidateProperty(DependencyProperty)

重新評估指定相依性屬性的有效值。

(繼承來源 DependencyObject)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
OnChanged()

目前的 Freezable 物件遭到修改時進行呼叫。

(繼承來源 Freezable)
OnFreezablePropertyChanged(DependencyObject, DependencyObject)

確定已為剛剛設定的 DependencyObjectType 資料成員,建立適當的內容指標。

(繼承來源 Freezable)
OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty)

此成員支援Windows Presentation Foundation (WPF) 基礎結構,而且不適合直接從您的程式碼使用。

(繼承來源 Freezable)
OnPropertyChanged(DependencyPropertyChangedEventArgs)

覆寫 OnPropertyChanged(DependencyPropertyChangedEventArgs)DependencyObject 實作也可以叫用任何 Changed 處理常式,以回應類型 Freezable 的變更相依性屬性。

(繼承來源 Freezable)
ReadLocalValue(DependencyProperty)

傳回相依性屬性的區域值 (如果存在)。

(繼承來源 DependencyObject)
ReadPreamble()

確定 Freezable 是從有效的執行緒進行存取。 如果 API 會讀取非相依性屬性的資料成員,則 Freezable 的繼承者必須在該 API 的開頭呼叫這個方法。

(繼承來源 Freezable)
SetCurrentValue(DependencyProperty, Object)

設定相依性屬性的值,而不需要變更其值來源。

(繼承來源 DependencyObject)
SetValue(DependencyProperty, Object)

設定相依性屬性的區域值 (由相依性屬性的識別碼所指定)。

(繼承來源 DependencyObject)
SetValue(DependencyPropertyKey, Object)

設定唯讀相依性屬性的區域數值 (由相依性屬性的 DependencyPropertyKey 識別項所指定)。

(繼承來源 DependencyObject)
ShouldSerializeProperty(DependencyProperty)

傳回值,這個值表示序列化程序是否應該序列化所提供相依性屬性的值。

(繼承來源 DependencyObject)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)
VerifyAccess()

請強制執行可以存取這個 DispatcherObject 的呼叫執行緒。

(繼承來源 DispatcherObject)
WritePostscript()

引發 FreezableChanged 事件,並叫用其 OnChanged() 方法。 在任何 API 修改未以相依性屬性儲存的類別成員之後,衍生自 Freezable 的類別應該在 API 的結尾呼叫這個方法。

(繼承來源 Freezable)
WritePreamble()

確認 Freezable 未凍結,而且是從有效的執行緒內容進行存取。 在任何 API 將資料寫入至非相依性屬性的資料成員之前,Freezable 繼承者應該在 API 的開頭呼叫這個方法。

(繼承來源 Freezable)

事件

Changed

發生於 Freezable 或所含的物件遭到修改時。

(繼承來源 Freezable)

適用於

另請參閱