Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

BezierSegment Constructor (Point, Point, Point, Boolean)

Initializes a new instance of the BezierSegment class with the specified control points, end point, and stroke option.

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

public BezierSegment(
	Point point1,
	Point point2,
	Point point3,
	bool isStroked
)

Parameters

point1
Type: System.Windows.Point

The first control point, which determines the beginning portion of the curve.

point2
Type: System.Windows.Point

The second control point, which determines the ending portion of the curve.

point3
Type: System.Windows.Point

The point to which the curve is drawn.

isStroked
Type: System.Boolean

true to stroke the curve when a Pen is used to render the segment; otherwise, false.

A cubic Bezier curve is defined by four points: a start point, an end point (point3), and two control points (point1 and point2). This method does not enable you to specify the beginning point of the curve; the curve begins at the current point of the PathFigure object to which the BezierSegment is added.

The two control points of a cubic Bezier curve behave like magnets, attracting portions of what would otherwise be a straight line toward themselves and producing a curve. The first control point, point1, affects the beginning portion of the curve; the second control point, point2, affects the ending portion of the curve. Note that the curve doesn't necessarily pass through either of the control points; each control point moves its portion of the line toward itself, but not through itself.

This example shows how to create a cubic Bezier curve. To create a cubic Bezier curve, use the PathGeometry, PathFigure, and BezierSegment classes. To display the resulting geometry, use a Path element, or use it with a GeometryDrawing or a DrawingContext. In the following examples, a cubic Bezier curve is drawn from (10, 100) to (300, 100). The curve has control points of (100, 0) and (200, 200).

[xaml]

In Extensible Application Markup Language (XAML), you may use abbreviated markup syntax to describe a path.

<Path Stroke="Black" StrokeThickness="1"  
  Data="M 10,100 C 100,0 200,200 300,100" />

[xaml]

In XAML, you can also draw a cubic Bezier curve using object tags. The following is equivalent to the previous XAML example.

<Path Stroke="Black" StrokeThickness="1">
  <Path.Data>
    <PathGeometry>
      <PathGeometry.Figures>
        <PathFigureCollection>
          <PathFigure StartPoint="10,100">
            <PathFigure.Segments>
              <PathSegmentCollection>
                <BezierSegment Point1="100,0" Point2="200,200" Point3="300,100" />
              </PathSegmentCollection>
            </PathFigure.Segments>
          </PathFigure>
        </PathFigureCollection>
      </PathGeometry.Figures>
    </PathGeometry>
  </Path.Data>
</Path>

This example is part of larger sample; for the complete sample, see the Geometries Sample.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft