GraphicsPath.AddCurve 方法

定义

向当前图形添加一段样条曲线。 由于曲线经过数组中的每个点,因此使用基数样条曲线。

重载

AddCurve(ReadOnlySpan<Point>, Single)
AddCurve(PointF[], Int32, Int32, Single)

向当前图形添加一段样条曲线。

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

向当前图形添加一段样条曲线。

AddCurve(ReadOnlySpan<PointF>, Single)
AddCurve(PointF[], Single)

向当前图形添加一段样条曲线。

AddCurve(Point[])

向当前图形添加一段样条曲线。 由于曲线经过数组中的每个点,因此使用基数样条曲线。

AddCurve(ReadOnlySpan<PointF>)
AddCurve(ReadOnlySpan<Point>)
AddCurve(PointF[])

向当前图形添加一段样条曲线。 由于曲线经过数组中的每个点,因此使用基数样条曲线。

AddCurve(Point[], Single)

向当前图形添加一段样条曲线。

AddCurve(ReadOnlySpan<Point>, Single)

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

参数

tension
Single

适用于

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

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

向当前图形添加一段样条曲线。

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)

参数

points
PointF[]

一个 PointF 结构的数组,它表示定义曲线的点。

offset
Int32

points 数组中某元素的索引,该元素将用作曲线的第一个点。

numberOfSegments
Int32

用于绘制曲线的线段的数目。 线段可被视为连接两点的直线。

tension
Single

指定曲线在控制点间弯曲程度的值。 大于 1 的值将产生不可预知的结果。

示例

有关示例,请参见 AddCurve(Point[], Int32, Int32, Single)

注解

如果需要,用户必须保留原始点。 原始点在内部转换为三次贝塞尔控制点,因此没有返回原始点的机制。

曲线从 指定的 offset数组中的点开始,包括指定的 numberOfSegments (段) 的点数。

适用于

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

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

向当前图形添加一段样条曲线。

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)

参数

points
Point[]

一个 Point 结构的数组,它表示定义曲线的点。

offset
Int32

points 数组中某元素的索引,该元素将用作曲线的第一个点。

numberOfSegments
Int32

指定曲线在控制点间弯曲程度的值。 大于 1 的值将产生不可预知的结果。

tension
Single

指定曲线在控制点间弯曲程度的值。 大于 1 的值将产生不可预知的结果。

示例

下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse事件OnPaint对象。 此代码执行以下操作:

  • 创建一个由四个点构成的数组, (表示基数样条) 。

  • 创建路径并使用点数组将曲线添加到路径。

  • 绘制屏幕的路径。

请注意,虽然数组包含四个点,但只有三个段,这是调用 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

注解

如果需要,用户必须保留原始点。 原始点在内部转换为三次贝塞尔控制点,因此没有返回原始点的机制。

曲线从 参数指定的 offset 数组中的点开始,并包括 由 numberOfSegments指定的) 段 (点数。

适用于

AddCurve(ReadOnlySpan<PointF>, Single)

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

参数

tension
Single

适用于

AddCurve(PointF[], Single)

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

向当前图形添加一段样条曲线。

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)

参数

points
PointF[]

一个 PointF 结构的数组,它表示定义曲线的点。

tension
Single

指定曲线在控制点间弯曲程度的值。 大于 1 的值将产生不可预知的结果。

示例

有关示例,请参见 AddCurve(Point[], Int32, Int32, Single)

注解

如果需要,用户必须保留原始点。 原始点在内部转换为三次贝塞尔控制点,因此没有返回原始点的机制。

适用于

AddCurve(Point[])

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

向当前图形添加一段样条曲线。 由于曲线经过数组中的每个点,因此使用基数样条曲线。

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

参数

points
Point[]

一个 Point 结构的数组,它表示定义曲线的点。

示例

有关示例,请参见 AddClosedCurve(Point[], Single)

注解

如果需要,用户必须保留原始点。 原始点在内部转换为三次贝塞尔控制点,因此没有返回原始点的机制。

适用于

AddCurve(ReadOnlySpan<PointF>)

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

参数

适用于

AddCurve(ReadOnlySpan<Point>)

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

参数

适用于

AddCurve(PointF[])

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

向当前图形添加一段样条曲线。 由于曲线经过数组中的每个点,因此使用基数样条曲线。

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

参数

points
PointF[]

一个 PointF 结构的数组,它表示定义曲线的点。

示例

有关示例,请参见 AddCurve(Point[], Int32, Int32, Single)

注解

如果需要,用户必须保留原始点。 原始点在内部转换为三次贝塞尔控制点,因此没有返回原始点的机制。

适用于

AddCurve(Point[], Single)

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

向当前图形添加一段样条曲线。

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)

参数

points
Point[]

一个 Point 结构的数组,它表示定义曲线的点。

tension
Single

指定曲线在控制点间弯曲程度的值。 大于 1 的值将产生不可预知的结果。

示例

有关示例,请参见 AddClosedCurve(Point[], Single)

注解

如果需要,用户必须保留原始点。 原始点在内部转换为三次贝塞尔控制点,因此没有返回原始点的机制。

适用于