แก้ไข

แชร์ผ่าน


GraphicsPath.AddCurve Method

Definition

Adds a spline curve to the current figure. A cardinal spline curve is used because the curve travels through each of the points in the array.

Overloads

AddCurve(ReadOnlySpan<Point>, Single)

Adds a spline curve to the current figure.

AddCurve(PointF[], Int32, Int32, Single)

Adds a spline curve to the current figure.

AddCurve(Point[], Int32, Int32, Single)

Adds a spline curve to the current figure.

AddCurve(ReadOnlySpan<PointF>, Single)

Adds a spline curve to the current figure.

AddCurve(PointF[], Single)

Adds a spline curve to the current figure.

AddCurve(Point[])

Adds a spline curve to the current figure. A cardinal spline curve is used because the curve travels through each of the points in the array.

AddCurve(ReadOnlySpan<PointF>)

Adds a spline curve to the current figure.

AddCurve(ReadOnlySpan<Point>)

Adds a spline curve to the current figure.

AddCurve(PointF[])

Adds a spline curve to the current figure. A cardinal spline curve is used because the curve travels through each of the points in the array.

AddCurve(Point[], Single)

Adds a spline curve to the current figure.

AddCurve(ReadOnlySpan<Point>, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a spline curve to the current figure.

public:
 void AddCurve(ReadOnlySpan<System::Drawing::Point> points, float tension);
public void AddCurve (ReadOnlySpan<System.Drawing.Point> points, float tension);
member this.AddCurve : ReadOnlySpan<System.Drawing.Point> * single -> unit
Public Sub AddCurve (points As ReadOnlySpan(Of Point), tension As Single)

Parameters

points
ReadOnlySpan<Point>

An array of PointF structures that represents the points that define the curve.

tension
Single

A value that specifies the amount that the curve bends between control points. Values greater than 1 produce unpredictable results.

Applies to

AddCurve(PointF[], Int32, Int32, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a spline curve to the current figure.

public:
 void AddCurve(cli::array <System::Drawing::PointF> ^ points, int offset, int numberOfSegments, float tension);
public void AddCurve (System.Drawing.PointF[] points, int offset, int numberOfSegments, float tension);
member this.AddCurve : System.Drawing.PointF[] * int * int * single -> unit
Public Sub AddCurve (points As PointF(), offset As Integer, numberOfSegments As Integer, tension As Single)

Parameters

points
PointF[]

An array of PointF structures that represents the points that define the curve.

offset
Int32

The index of the element in the points array that is used as the first point in the curve.

numberOfSegments
Int32

The number of segments used to draw the curve. A segment can be thought of as a line connecting two points.

tension
Single

A value that specifies the amount that the curve bends between control points. Values greater than 1 produce unpredictable results.

Examples

For an example, see AddCurve(Point[], Int32, Int32, Single).

Remarks

The user must keep the original points if they are needed. The original points are converted to cubic Bézier control points internally, therefore there is no mechanism for returning the original points.

The curve begins at the point in the array specified by offset, and includes the number of points (segments) specified by numberOfSegments.

Applies to

AddCurve(Point[], Int32, Int32, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a spline curve to the current figure.

public:
 void AddCurve(cli::array <System::Drawing::Point> ^ points, int offset, int numberOfSegments, float tension);
public void AddCurve (System.Drawing.Point[] points, int offset, int numberOfSegments, float tension);
member this.AddCurve : System.Drawing.Point[] * int * int * single -> unit
Public Sub AddCurve (points As Point(), offset As Integer, numberOfSegments As Integer, tension As Single)

Parameters

points
Point[]

An array of Point structures that represents the points that define the curve.

offset
Int32

The index of the element in the points array that is used as the first point in the curve.

numberOfSegments
Int32

A value that specifies the amount that the curve bends between control points. Values greater than 1 produce unpredictable results.

tension
Single

A value that specifies the amount that the curve bends between control points. Values greater than 1 produce unpredictable results.

Examples

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, an OnPaint event object. The code performs the following actions:

  • Creates an array of four points (representing a cardinal spline).

  • Creates a path and using the array of points, adds the curve to the path.

  • Draws the path to the screen.

Notice that while the array holds four points, there are only three segments, which is the number specified in the third argument of the call to AddCurve.

private:
   void AddCurveExample( PaintEventArgs^ e )
   {
      // Create some points.
      Point point1 = Point(20,20);
      Point point2 = Point(40,0);
      Point point3 = Point(60,40);
      Point point4 = Point(80,20);

      // Create an array of the points.
      array<Point>^ curvePoints = {point1,point2,point3,point4};

      // Create a GraphicsPath object and add a curve.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddCurve( curvePoints, 0, 3, 0.8f );

      // Draw the path to the screen.
      Pen^ myPen = gcnew Pen( Color::Black,2.0f );
      e->Graphics->DrawPath( myPen, myPath );
   }
private void AddCurveExample(PaintEventArgs e)
{
             
    // Create some points.
    Point point1 = new Point(20, 20);
    Point point2 = new Point(40, 0);
    Point point3 = new Point(60, 40);
    Point point4 = new Point(80, 20);
             
    // Create an array of the points.
    Point[] curvePoints = {point1, point2, point3, point4};
             
    // Create a GraphicsPath object and add a curve.
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddCurve(curvePoints, 0, 3, 0.8f);
             
    // Draw the path to the screen.
    Pen myPen = new Pen(Color.Black, 2);
    e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddCurveExample(ByVal e As PaintEventArgs)

    ' Create some points.
    Dim point1 As New Point(20, 20)
    Dim point2 As New Point(40, 0)
    Dim point3 As New Point(60, 40)
    Dim point4 As New Point(80, 20)

    ' Create an array of the points.
    Dim curvePoints As Point() = {point1, point2, point3, point4}

    ' Create a GraphicsPath object and add a curve.
    Dim myPath As New GraphicsPath
    myPath.AddCurve(curvePoints, 0, 3, 0.8F)

    ' Draw the path to the screen.
    Dim myPen As New Pen(Color.Black, 2)
    e.Graphics.DrawPath(myPen, myPath)
End Sub

Remarks

The user must keep the original points if they are needed. The original points are converted to cubic Bézier control points internally, therefore there is no mechanism for returning the original points.

The curve begins at the point in the array specified by the offset parameter and includes the number of points (segments) specified by numberOfSegments.

Applies to

AddCurve(ReadOnlySpan<PointF>, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a spline curve to the current figure.

public:
 void AddCurve(ReadOnlySpan<System::Drawing::PointF> points, float tension);
public void AddCurve (ReadOnlySpan<System.Drawing.PointF> points, float tension);
member this.AddCurve : ReadOnlySpan<System.Drawing.PointF> * single -> unit
Public Sub AddCurve (points As ReadOnlySpan(Of PointF), tension As Single)

Parameters

points
ReadOnlySpan<PointF>

An array of PointF structures that represents the points that define the curve.

tension
Single

A value that specifies the amount that the curve bends between control points. Values greater than 1 produce unpredictable results.

Applies to

AddCurve(PointF[], Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a spline curve to the current figure.

public:
 void AddCurve(cli::array <System::Drawing::PointF> ^ points, float tension);
public void AddCurve (System.Drawing.PointF[] points, float tension);
member this.AddCurve : System.Drawing.PointF[] * single -> unit
Public Sub AddCurve (points As PointF(), tension As Single)

Parameters

points
PointF[]

An array of PointF structures that represents the points that define the curve.

tension
Single

A value that specifies the amount that the curve bends between control points. Values greater than 1 produce unpredictable results.

Examples

For an example, see AddCurve(Point[], Int32, Int32, Single).

Remarks

The user must keep the original points if they are needed. The original points are converted to cubic Bézier control points internally, therefore there is no mechanism for returning the original points.

Applies to

AddCurve(Point[])

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a spline curve to the current figure. A cardinal spline curve is used because the curve travels through each of the points in the array.

public:
 void AddCurve(... cli::array <System::Drawing::Point> ^ points);
public:
 void AddCurve(cli::array <System::Drawing::Point> ^ points);
public void AddCurve (params System.Drawing.Point[] points);
public void AddCurve (System.Drawing.Point[] points);
member this.AddCurve : System.Drawing.Point[] -> unit
Public Sub AddCurve (ParamArray points As Point())
Public Sub AddCurve (points As Point())

Parameters

points
Point[]

An array of Point structures that represents the points that define the curve.

Examples

For an example, see AddClosedCurve(Point[], Single).

Remarks

The user must keep the original points if they are needed. The original points are converted to cubic Bézier control points internally, therefore there is no mechanism for returning the original points.

Applies to

AddCurve(ReadOnlySpan<PointF>)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a spline curve to the current figure.

public:
 void AddCurve(ReadOnlySpan<System::Drawing::PointF> points);
public void AddCurve (scoped ReadOnlySpan<System.Drawing.PointF> points);
member this.AddCurve : ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub AddCurve (points As ReadOnlySpan(Of PointF))

Parameters

points
ReadOnlySpan<PointF>

An array of PointF structures that represents the points that define the curve.

Applies to

AddCurve(ReadOnlySpan<Point>)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a spline curve to the current figure.

public:
 void AddCurve(ReadOnlySpan<System::Drawing::Point> points);
public void AddCurve (ReadOnlySpan<System.Drawing.Point> points);
member this.AddCurve : ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub AddCurve (points As ReadOnlySpan(Of Point))

Parameters

points
ReadOnlySpan<Point>

An array of PointF structures that represents the points that define the curve.

Applies to

AddCurve(PointF[])

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a spline curve to the current figure. A cardinal spline curve is used because the curve travels through each of the points in the array.

public:
 void AddCurve(... cli::array <System::Drawing::PointF> ^ points);
public:
 void AddCurve(cli::array <System::Drawing::PointF> ^ points);
public void AddCurve (params System.Drawing.PointF[] points);
public void AddCurve (System.Drawing.PointF[] points);
member this.AddCurve : System.Drawing.PointF[] -> unit
Public Sub AddCurve (ParamArray points As PointF())
Public Sub AddCurve (points As PointF())

Parameters

points
PointF[]

An array of PointF structures that represents the points that define the curve.

Examples

For an example, see AddCurve(Point[], Int32, Int32, Single).

Remarks

The user must keep the original points if they are needed. The original points are converted to cubic Bézier control points internally, therefore there is no mechanism for returning the original points.

Applies to

AddCurve(Point[], Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a spline curve to the current figure.

public:
 void AddCurve(cli::array <System::Drawing::Point> ^ points, float tension);
public void AddCurve (System.Drawing.Point[] points, float tension);
member this.AddCurve : System.Drawing.Point[] * single -> unit
Public Sub AddCurve (points As Point(), tension As Single)

Parameters

points
Point[]

An array of Point structures that represents the points that define the curve.

tension
Single

A value that specifies the amount that the curve bends between control points. Values greater than 1 produce unpredictable results.

Examples

For an example, see AddClosedCurve(Point[], Single).

Remarks

The user must keep the original points if they are needed. The original points are converted to cubic Bézier control points internally, therefore there is no mechanism for returning the original points.

Applies to