Прочитај на енглеском Уреди

Делите путем


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
Source:
GraphicsPath.cs

Adds a spline curve to the current figure.

C#
public void AddCurve(ReadOnlySpan<System.Drawing.Point> points, float tension);

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 9 (package-provided), 10 (package-provided)
Windows Desktop 9, 10

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

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

Adds a spline curve to the current figure.

C#
public void AddCurve(System.Drawing.PointF[] points, int offset, int numberOfSegments, float tension);

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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

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

Adds a spline curve to the current figure.

C#
public void AddCurve(System.Drawing.Point[] points, int offset, int numberOfSegments, float tension);

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.

C#
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);
}

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

AddCurve(ReadOnlySpan<PointF>, Single)

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

Adds a spline curve to the current figure.

C#
public void AddCurve(ReadOnlySpan<System.Drawing.PointF> points, float tension);

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 9 (package-provided), 10 (package-provided)
Windows Desktop 9, 10

AddCurve(PointF[], Single)

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

Adds a spline curve to the current figure.

C#
public void AddCurve(System.Drawing.PointF[] points, float tension);

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

AddCurve(Point[])

Source:
GraphicsPath.cs
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.

C#
public void AddCurve(params System.Drawing.Point[] points);
C#
public void AddCurve(System.Drawing.Point[] points);

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

AddCurve(ReadOnlySpan<PointF>)

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

Adds a spline curve to the current figure.

C#
public void AddCurve(scoped ReadOnlySpan<System.Drawing.PointF> points);

Parameters

points
ReadOnlySpan<PointF>

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

Applies to

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 9 (package-provided), 10 (package-provided)
Windows Desktop 9, 10

AddCurve(ReadOnlySpan<Point>)

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

Adds a spline curve to the current figure.

C#
public void AddCurve(ReadOnlySpan<System.Drawing.Point> points);

Parameters

points
ReadOnlySpan<Point>

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

Applies to

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 9 (package-provided), 10 (package-provided)
Windows Desktop 9, 10

AddCurve(PointF[])

Source:
GraphicsPath.cs
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.

C#
public void AddCurve(params System.Drawing.PointF[] points);
C#
public void AddCurve(System.Drawing.PointF[] points);

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

AddCurve(Point[], Single)

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

Adds a spline curve to the current figure.

C#
public void AddCurve(System.Drawing.Point[] points, float tension);

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10