PolyBezierSegment.Points Property

 

Gets or sets the PointCollection that define this PolyBezierSegment object.

Namespace:   System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)

Public Property Points As PointCollection

Property Value

Type: System.Windows.Media.PointCollection

Collection that define this PolyBezierSegment object.

Identifier field

PointsProperty

Metadata properties set to true

None

The following example shows how to use the Points property of a PolyBezierSegment that defines two cubic Bezier curves.

<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>

Imports System
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

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: