PolyQuadraticBezierSegment 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示一組二次方貝茲區段。
public ref class PolyQuadraticBezierSegment sealed : System::Windows::Media::PathSegment
public sealed class PolyQuadraticBezierSegment : System.Windows.Media.PathSegment
type PolyQuadraticBezierSegment = class
inherit PathSegment
Public NotInheritable Class PolyQuadraticBezierSegment
Inherits PathSegment
- 繼承
-
PolyQuadraticBezierSegment
範例
下列範例示範如何使用 PolyQuadraticBezierSegment 來建立兩個二次方 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 PolyQuadraticBezierSegment specifies two Bezier curves.
The first curve is from 10,100 (start point specified above)
to 300,100 with a control point of 200,200. The second curve
is from 200,200 (end of the last curve) to 30,400 with a
control point of 0,200. -->
<PolyQuadraticBezierSegment Points="200,200 300,100 0,200 30,400" />
</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 PolyQuadraticBezierSegmentExample : Page
{
public PolyQuadraticBezierSegmentExample()
{
// 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 PolyQuadraticBezierSegment below.
PointCollection myPointCollection = new PointCollection(4);
myPointCollection.Add(new Point(200, 200));
myPointCollection.Add(new Point(300, 100));
myPointCollection.Add(new Point(0, 200));
myPointCollection.Add(new Point(30, 400));
// The PolyQuadraticBezierSegment specifies two Bezier curves.
// The first curve is from 10,100 (start point specified above)
// to 300,100 with a control point of 200,200. The second curve
// is from 200,200 (end of the last curve) to 30,400 with a
// control point of 0,200.
PolyQuadraticBezierSegment myBezierSegment = new PolyQuadraticBezierSegment();
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 PolyQuadraticBezierSegmentExample
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 PolyQuadraticBezierSegment below.
Dim myPointCollection As New PointCollection(4)
myPointCollection.Add(New Point(200, 200))
myPointCollection.Add(New Point(300, 100))
myPointCollection.Add(New Point(0, 200))
myPointCollection.Add(New Point(30, 400))
' The PolyQuadraticBezierSegment specifies two Bezier curves.
' The first curve is from 10,100 (start point specified above)
' to 300,100 with a control point of 200,200. The second curve
' is from 200,200 (end of the last curve) to 30,400 with a
' control point of 0,200.
Dim myBezierSegment As New PolyQuadraticBezierSegment()
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
備註
這個類別可讓您指定點集合,以建立多個二次方 Bezier 曲線區段。 QuadraticBezierSegment使用 ,您只能指定兩個點來建立單一二次方貝茲曲線區段。
建構函式
PolyQuadraticBezierSegment() |
初始化 PolyQuadraticBezierSegment 類別的新執行個體。 |
PolyQuadraticBezierSegment(IEnumerable<Point>, Boolean) |
初始化 PolyQuadraticBezierSegment 類別的新執行個體,這個執行個體具有指定之 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,它會定義這個 PolyQuadraticBezierSegment 物件。 |
方法
事件
Changed |
發生於 Freezable 或所含的物件遭到修改時。 (繼承來源 Freezable) |