Graphics.DrawCurve Graphics.DrawCurve Graphics.DrawCurve Method

Definición

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras Point.Draws a cardinal spline through a specified array of Point structures.

Sobrecargas

DrawCurve(Pen, Point[]) DrawCurve(Pen, Point[]) DrawCurve(Pen, Point[])

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras Point.Draws a cardinal spline through a specified array of Point structures.

DrawCurve(Pen, PointF[]) DrawCurve(Pen, PointF[]) DrawCurve(Pen, PointF[])

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras PointF.Draws a cardinal spline through a specified array of PointF structures.

DrawCurve(Pen, Point[], Single) DrawCurve(Pen, Point[], Single) DrawCurve(Pen, Point[], Single)

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras Point, usando la tensión especificada.Draws a cardinal spline through a specified array of Point structures using a specified tension.

DrawCurve(Pen, PointF[], Single) DrawCurve(Pen, PointF[], Single) DrawCurve(Pen, PointF[], Single)

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras PointF, usando la tensión especificada.Draws a cardinal spline through a specified array of PointF structures using a specified tension.

DrawCurve(Pen, PointF[], Int32, Int32) DrawCurve(Pen, PointF[], Int32, Int32) DrawCurve(Pen, PointF[], Int32, Int32)

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras PointF.Draws a cardinal spline through a specified array of PointF structures. El dibujo comienza su desplazamiento a partir del comienzo de la matriz.The drawing begins offset from the beginning of the array.

DrawCurve(Pen, Point[], Int32, Int32, Single) DrawCurve(Pen, Point[], Int32, Int32, Single) DrawCurve(Pen, Point[], Int32, Int32, Single)

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras Point, usando la tensión especificada.Draws a cardinal spline through a specified array of Point structures using a specified tension.

DrawCurve(Pen, PointF[], Int32, Int32, Single) DrawCurve(Pen, PointF[], Int32, Int32, Single) DrawCurve(Pen, PointF[], Int32, Int32, Single)

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras PointF, usando la tensión especificada.Draws a cardinal spline through a specified array of PointF structures using a specified tension. El dibujo comienza su desplazamiento a partir del comienzo de la matriz.The drawing begins offset from the beginning of the array.

DrawCurve(Pen, Point[]) DrawCurve(Pen, Point[]) DrawCurve(Pen, Point[])

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras Point.Draws a cardinal spline through a specified array of Point structures.

public:
 void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Point> ^ points);
public void DrawCurve (System.Drawing.Pen pen, System.Drawing.Point[] points);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.Point[] -> unit

Parámetros

pen
Pen Pen Pen

Pen que determina el color, ancho y alto de la curva.Pen that determines the color, width, and height of the curve.

points
Point[]

Matriz de estructuras Point que definen la curva spline.Array of Point structures that define the spline.

Excepciones

pen es null.pen is null.

O bien-or- points es null.points is null.

Ejemplos

El siguiente ejemplo de código está diseñado para su uso con Windows Forms y requiere PaintEventArgs e, que Paint es un parámetro del controlador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. El código realiza las siguientes acciones:The code performs the following actions:

  • Crea bolígrafos rojos y verdes.Creates red and green pens.

  • Crea siete puntos para definir una curva.Creates seven points to define a curve.

  • Dibuja seis líneas rectas rojas entre los siete puntos para formar un polígono incompleto.Draws six red straight lines between the seven points to form an incomplete polygon.

  • Dibuja una curva verde abierta a través de los siete puntos.Draws an open green curve through the seven points.

El método usa una tensión predeterminada de 0,5.The method uses a default tension of 0.5.

private:
   void DrawCurvePoint( PaintEventArgs^ e )
   {
      // Create pens.
      Pen^ redPen = gcnew Pen( Color::Red,3.0f );
      Pen^ greenPen = gcnew Pen( Color::Green,3.0f );

      // Create points that define curve.
      Point point1 = Point(50,50);
      Point point2 = Point(100,25);
      Point point3 = Point(200,5);
      Point point4 = Point(250,50);
      Point point5 = Point(300,100);
      Point point6 = Point(350,200);
      Point point7 = Point(250,250);
      array<Point>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};

      // Draw lines between original points to screen.
      e->Graphics->DrawLines( redPen, curvePoints );

      // Draw curve to screen.
      e->Graphics->DrawCurve( greenPen, curvePoints );
   }
private void DrawCurvePoint(PaintEventArgs e)
{

    // Create pens.
    Pen redPen = new Pen(Color.Red, 3);
    Pen greenPen = new Pen(Color.Green, 3);

    // Create points that define curve.
    Point point1 = new Point(50, 50);
    Point point2 = new Point(100, 25);
    Point point3 = new Point(200, 5);
    Point point4 = new Point(250, 50);
    Point point5 = new Point(300, 100);
    Point point6 = new Point(350, 200);
    Point point7 = new Point(250, 250);
    Point[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};

    // Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints);

    // Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints);
}
Private Sub DrawCurvePoint(ByVal e As PaintEventArgs)

    ' Create pens.
    Dim redPen As New Pen(Color.Red, 3)
    Dim greenPen As New Pen(Color.Green, 3)

    ' Create points that define curve.
    Dim point1 As New Point(50, 50)
    Dim point2 As New Point(100, 25)
    Dim point3 As New Point(200, 5)
    Dim point4 As New Point(250, 50)
    Dim point5 As New Point(300, 100)
    Dim point6 As New Point(350, 200)
    Dim point7 As New Point(250, 250)
    Dim curvePoints As Point() = {point1, point2, point3, point4, _
    point5, point6, point7}

    ' Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints)

    ' Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints)
End Sub

Comentarios

Este método dibuja una curva spline cardinal que pasa a través de cada punto de la matriz.This method draws a cardinal spline that passes through each point in the array.

La matriz de puntos debe contener al menos tres Point estructuras para dibujar una curva.The array of points must contain at least three Point structures for a curve to be drawn.

Este método usa una tensión predeterminada de 0,5.This method uses a default tension of 0.5.

DrawCurve(Pen, PointF[]) DrawCurve(Pen, PointF[]) DrawCurve(Pen, PointF[])

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras PointF.Draws a cardinal spline through a specified array of PointF structures.

public:
 void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points);
public void DrawCurve (System.Drawing.Pen pen, System.Drawing.PointF[] points);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.PointF[] -> unit

Parámetros

pen
Pen Pen Pen

Pen que determina el color, ancho y estilo de la curva.Pen that determines the color, width, and style of the curve.

points
PointF[]

Matriz de estructuras PointF que definen la curva spline.Array of PointF structures that define the spline.

Excepciones

pen es null.pen is null.

O bien-or- points es null.points is null.

Ejemplos

El siguiente ejemplo de código está diseñado para su uso con Windows Forms y requiere PaintEventArgs e, que Paint es un parámetro del controlador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. El código realiza las siguientes acciones:The code performs the following actions:

  • Crea bolígrafos rojos y verdes.Creates red and green pens.

  • Crea siete puntos para definir una curva.Creates seven points to define a curve.

  • Dibuja seis líneas rectas rojas entre los siete puntos para formar un polígono incompleto.Draws six red straight lines between the seven points to form an incomplete polygon.

  • Dibuja una curva verde abierta a través de los siete puntos.Draws an open green curve through the seven points.

El método usa una tensión predeterminada de 0,5.The method uses a default tension of 0.5.

private:
   void DrawCurvePointF( PaintEventArgs^ e )
   {
      // Create pens.
      Pen^ redPen = gcnew Pen( Color::Red,3.0f );
      Pen^ greenPen = gcnew Pen( Color::Green,3.0f );

      // Create points that define curve.
      PointF point1 = PointF(50.0F,50.0F);
      PointF point2 = PointF(100.0F,25.0F);
      PointF point3 = PointF(200.0F,5.0F);
      PointF point4 = PointF(250.0F,50.0F);
      PointF point5 = PointF(300.0F,100.0F);
      PointF point6 = PointF(350.0F,200.0F);
      PointF point7 = PointF(250.0F,250.0F);
      array<PointF>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};

      // Draw lines between original points to screen.
      e->Graphics->DrawLines( redPen, curvePoints );

      // Draw curve to screen.
      e->Graphics->DrawCurve( greenPen, curvePoints );
   }
private void DrawCurvePointF(PaintEventArgs e)
{

    // Create pens.
    Pen redPen = new Pen(Color.Red, 3);
    Pen greenPen = new Pen(Color.Green, 3);

    // Create points that define curve.
    PointF point1 = new PointF(50.0F, 50.0F);
    PointF point2 = new PointF(100.0F, 25.0F);
    PointF point3 = new PointF(200.0F, 5.0F);
    PointF point4 = new PointF(250.0F, 50.0F);
    PointF point5 = new PointF(300.0F, 100.0F);
    PointF point6 = new PointF(350.0F, 200.0F);
    PointF point7 = new PointF(250.0F, 250.0F);
    PointF[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};

    // Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints);

    // Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints);
}
Private Sub DrawCurvePointF(ByVal e As PaintEventArgs)

    ' Create pens.
    Dim redPen As New Pen(Color.Red, 3)
    Dim greenPen As New Pen(Color.Green, 3)

    ' Create points that define curve.
    Dim point1 As New PointF(50.0F, 50.0F)
    Dim point2 As New PointF(100.0F, 25.0F)
    Dim point3 As New PointF(200.0F, 5.0F)
    Dim point4 As New PointF(250.0F, 50.0F)
    Dim point5 As New PointF(300.0F, 100.0F)
    Dim point6 As New PointF(350.0F, 200.0F)
    Dim point7 As New PointF(250.0F, 250.0F)
    Dim curvePoints As PointF() = {point1, point2, point3, point4, _
    point5, point6, point7}

    ' Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints)

    ' Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints)
End Sub

Comentarios

Este método dibuja una curva spline cardinal que pasa a través de cada punto de la matriz.This method draws a cardinal spline that passes through each point in the array.

La matriz de puntos debe contener al menos tres PointF estructuras para dibujar una curva.The array of points must contain at least three PointF structures for a curve to be drawn.

Este método usa una tensión predeterminada de 0,5.This method uses a default tension of 0.5.

DrawCurve(Pen, Point[], Single) DrawCurve(Pen, Point[], Single) DrawCurve(Pen, Point[], Single)

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras Point, usando la tensión especificada.Draws a cardinal spline through a specified array of Point structures using a specified tension.

public:
 void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Point> ^ points, float tension);
public void DrawCurve (System.Drawing.Pen pen, System.Drawing.Point[] points, float tension);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.Point[] * single -> unit

Parámetros

pen
Pen Pen Pen

Pen que determina el color, ancho y estilo de la curva.Pen that determines the color, width, and style of the curve.

points
Point[]

Matriz de estructuras Point que definen la curva spline.Array of Point structures that define the spline.

tension
Single Single Single

Valor mayor o igual que 0,0F que especifica la tensión de la curva.Value greater than or equal to 0.0F that specifies the tension of the curve.

Excepciones

pen es null.pen is null.

o bien-or- points es null.points is null.

Ejemplos

El siguiente ejemplo de código está diseñado para su uso con Windows Forms y requiere PaintEventArgs e, que Paint es un parámetro del controlador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. El código realiza las siguientes acciones:The code performs the following actions:

  • Crea bolígrafos rojos y verdes.Creates red and green pens.

  • Crea siete puntos para definir la curva.Creates seven points to define the curve.

  • Dibuja seis líneas rectas rojas entre los siete puntos para formar un polígono incompleto.Draws six red straight lines between the seven points to form an incomplete polygon.

  • Crea una configuración de tensión.Creates a tension setting.

  • Dibuja una curva cerrada verde abierta a través de los siete puntos.Draws an open green closed curve through the seven points.

El método utiliza una tensión de 1,0.The method uses a tension of 1.0.

private:
   void DrawCurvePointTension( PaintEventArgs^ e )
   {

      // Create pens.
      Pen^ redPen = gcnew Pen( Color::Red,3.0f );
      Pen^ greenPen = gcnew Pen( Color::Green,3.0f );

      // Create points that define curve.
      Point point1 = Point(50,50);
      Point point2 = Point(100,25);
      Point point3 = Point(200,5);
      Point point4 = Point(250,50);
      Point point5 = Point(300,100);
      Point point6 = Point(350,200);
      Point point7 = Point(250,250);
      array<Point>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};

      // Draw lines between original points to screen.
      e->Graphics->DrawLines( redPen, curvePoints );

      // Create tension.
      float tension = 1.0F;

      // Draw curve to screen.
      e->Graphics->DrawCurve( greenPen, curvePoints, tension );
   }
private void DrawCurvePointTension(PaintEventArgs e)
{

    // Create pens.
    Pen redPen = new Pen(Color.Red, 3);
    Pen greenPen = new Pen(Color.Green, 3);

    // Create points that define curve.
    Point point1 = new Point(50, 50);
    Point point2 = new Point(100, 25);
    Point point3 = new Point(200, 5);
    Point point4 = new Point(250, 50);
    Point point5 = new Point(300, 100);
    Point point6 = new Point(350, 200);
    Point point7 = new Point(250, 250);
    Point[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};

    // Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints);

    // Create tension.
    float tension = 1.0F;

    // Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints, tension);
}
Private Sub DrawCurvePointTension(ByVal e As PaintEventArgs)

    ' Create pens.
    Dim redPen As New Pen(Color.Red, 3)
    Dim greenPen As New Pen(Color.Green, 3)

    ' Create points that define curve.
    Dim point1 As New Point(50, 50)
    Dim point2 As New Point(100, 25)
    Dim point3 As New Point(200, 5)
    Dim point4 As New Point(250, 50)
    Dim point5 As New Point(300, 100)
    Dim point6 As New Point(350, 200)
    Dim point7 As New Point(250, 250)
    Dim curvePoints As Point() = {point1, point2, point3, point4, _
    point5, point6, point7}

    ' Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints)

    ' Create tension.
    Dim tension As Single = 1.0F

    ' Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints, tension)
End Sub

Comentarios

Este método dibuja una curva spline cardinal que pasa a través de cada punto de la matriz.This method draws a cardinal spline that passes through each point in the array.

La matriz de puntos debe contener al menos tres Point estructuras para dibujar una curva.The array of points must contain at least three Point structures for a curve to be drawn.

El tension parámetro determina la forma de la curva spline.The tension parameter determines the shape of the spline. Si el valor del tension parámetro es 0,0 f, este método dibuja segmentos de línea recta para conectar los puntos.If the value of the tension parameter is 0.0F, this method draws straight line segments to connect the points. Normalmente, el tension parámetro es menor o igual que 1,0 f.Usually, the tension parameter is less than or equal to 1.0F. Los valores superiores a 1.0 F producen resultados poco habituales.Values over 1.0F produce unusual results.

DrawCurve(Pen, PointF[], Single) DrawCurve(Pen, PointF[], Single) DrawCurve(Pen, PointF[], Single)

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras PointF, usando la tensión especificada.Draws a cardinal spline through a specified array of PointF structures using a specified tension.

public:
 void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points, float tension);
public void DrawCurve (System.Drawing.Pen pen, System.Drawing.PointF[] points, float tension);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.PointF[] * single -> unit

Parámetros

pen
Pen Pen Pen

Pen que determina el color, ancho y estilo de la curva.Pen that determines the color, width, and style of the curve.

points
PointF[]

Matriz de estructuras PointF que representan los puntos que definen la curva.Array of PointF structures that represent the points that define the curve.

tension
Single Single Single

Valor mayor o igual que 0,0F que especifica la tensión de la curva.Value greater than or equal to 0.0F that specifies the tension of the curve.

Excepciones

pen es null.pen is null.

O bien-or- points es null.points is null.

Ejemplos

El siguiente ejemplo de código está diseñado para su uso con Windows Forms y requiere PaintEventArgs e, que Paint es un parámetro del controlador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. El código realiza las siguientes acciones:The code performs the following actions:

  • Crea bolígrafos rojos y verdes.Creates red and green pens.

  • Crea siete puntos para definir la curva.Creates seven points to define the curve.

  • Dibuja seis líneas rectas rojas entre los siete puntos para formar un polígono incompleto.Draws six red straight lines between the seven points to form an incomplete polygon.

  • Crea una configuración de tensión.Creates a tension setting.

  • Dibuja una curva cerrada verde abierta a través de los siete puntos.Draws an open green closed curve through the seven points.

El método utiliza una tensión de 1,0.The method uses a tension of 1.0.

private:
   void DrawCurvePointFTension( PaintEventArgs^ e )
   {
      // Create pens.
      Pen^ redPen = gcnew Pen( Color::Red,3.0f );
      Pen^ greenPen = gcnew Pen( Color::Green,3.0f );

      // Create points that define curve.
      PointF point1 = PointF(50.0F,50.0F);
      PointF point2 = PointF(100.0F,25.0F);
      PointF point3 = PointF(200.0F,5.0F);
      PointF point4 = PointF(250.0F,50.0F);
      PointF point5 = PointF(300.0F,100.0F);
      PointF point6 = PointF(350.0F,200.0F);
      PointF point7 = PointF(250.0F,250.0F);
      array<PointF>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};

      // Draw lines between original points to screen.
      e->Graphics->DrawLines( redPen, curvePoints );

      // Create tension.
      float tension = 1.0F;

      // Draw curve to screen.
      e->Graphics->DrawCurve( greenPen, curvePoints, tension );
   }
private void DrawCurvePointFTension(PaintEventArgs e)
{

    // Create pens.
    Pen redPen = new Pen(Color.Red, 3);
    Pen greenPen = new Pen(Color.Green, 3);

    // Create points that define curve.
    PointF point1 = new PointF(50.0F, 50.0F);
    PointF point2 = new PointF(100.0F, 25.0F);
    PointF point3 = new PointF(200.0F, 5.0F);
    PointF point4 = new PointF(250.0F, 50.0F);
    PointF point5 = new PointF(300.0F, 100.0F);
    PointF point6 = new PointF(350.0F, 200.0F);
    PointF point7 = new PointF(250.0F, 250.0F);
    PointF[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};

    // Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints);

    // Create tension.
    float tension = 1.0F;

    // Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints, tension);
}
Private Sub DrawCurvePointFTension(ByVal e As PaintEventArgs)

    ' Create pens.
    Dim redPen As New Pen(Color.Red, 3)
    Dim greenPen As New Pen(Color.Green, 3)

    ' Create points that define curve.
    Dim point1 As New PointF(50.0F, 50.0F)
    Dim point2 As New PointF(100.0F, 25.0F)
    Dim point3 As New PointF(200.0F, 5.0F)
    Dim point4 As New PointF(250.0F, 50.0F)
    Dim point5 As New PointF(300.0F, 100.0F)
    Dim point6 As New PointF(350.0F, 200.0F)
    Dim point7 As New PointF(250.0F, 250.0F)
    Dim curvePoints As PointF() = {point1, point2, point3, point4, _
    point5, point6, point7}

    ' Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints)

    ' Create tension.
    Dim tension As Single = 1.0F

    ' Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints, tension)
End Sub

Comentarios

Este método dibuja una curva spline cardinal que pasa a través de cada punto de la matriz.This method draws a cardinal spline that passes through each point in the array.

La matriz de puntos debe contener al menos tres PointF estructuras para dibujar una curva.The array of points must contain at least three PointF structures for a curve to be drawn.

El tension parámetro determina la forma de la curva spline.The tension parameter determines the shape of the spline. Si el valor del tension parámetro es 0,0 f, este método dibuja segmentos de línea recta para conectar los puntos.If the value of the tension parameter is 0.0F, this method draws straight line segments to connect the points. Normalmente, el tension parámetro es menor o igual que 1,0 f.Usually, the tension parameter is less than or equal to 1.0F. Los valores superiores a 1.0 F producen resultados poco habituales.Values over 1.0F produce unusual results.

DrawCurve(Pen, PointF[], Int32, Int32) DrawCurve(Pen, PointF[], Int32, Int32) DrawCurve(Pen, PointF[], Int32, Int32)

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras PointF.Draws a cardinal spline through a specified array of PointF structures. El dibujo comienza su desplazamiento a partir del comienzo de la matriz.The drawing begins offset from the beginning of the array.

public:
 void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points, int offset, int numberOfSegments);
public void DrawCurve (System.Drawing.Pen pen, System.Drawing.PointF[] points, int offset, int numberOfSegments);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.PointF[] * int * int -> unit

Parámetros

pen
Pen Pen Pen

Pen que determina el color, ancho y estilo de la curva.Pen that determines the color, width, and style of the curve.

points
PointF[]

Matriz de estructuras PointF que definen la curva spline.Array of PointF structures that define the spline.

offset
Int32 Int32 Int32

Desplazamiento entre el primer elemento de la matriz del parámetro points y el punto inicial de la curva.Offset from the first element in the array of the points parameter to the starting point in the curve.

numberOfSegments
Int32 Int32 Int32

Número de segmentos posteriores al punto inicial que se incluirán en la curva.Number of segments after the starting point to include in the curve.

Excepciones

pen es null.pen is null.

O bien-or- points es null.points is null.

Ejemplos

El siguiente ejemplo de código está diseñado para su uso con Windows Forms y requiere PaintEventArgs e, que Paint es un parámetro del controlador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. El código realiza las siguientes acciones:The code performs the following actions:

  • Crea bolígrafos rojos y verdes.Creates red and green pens.

  • Crea siete puntos para definir una curva.Creates seven points to define a curve.

  • Dibuja seis líneas rectas rojas entre los siete puntos para formar un polígono incompleto.Draws six red straight lines between the seven points to form an incomplete polygon.

  • Define el desplazamiento del punto inicial y el número de segmentos.Defines the starting point offset and number of segments.

  • Dibuja una curva verde abierta (a partir del tercer punto) a través de los cinco últimos puntos.Draws an open green curve (starting at the third point) through the last five points.

El método usa una tensión predeterminada de 0,5.The method uses a default tension of 0.5.

private:
   void DrawCurvePointFSegments( PaintEventArgs^ e )
   {
      // Create pens.
      Pen^ redPen = gcnew Pen( Color::Red,3.0f );
      Pen^ greenPen = gcnew Pen( Color::Green,3.0f );

      // Create points that define curve.
      PointF point1 = PointF(50.0F,50.0F);
      PointF point2 = PointF(100.0F,25.0F);
      PointF point3 = PointF(200.0F,5.0F);
      PointF point4 = PointF(250.0F,50.0F);
      PointF point5 = PointF(300.0F,100.0F);
      PointF point6 = PointF(350.0F,200.0F);
      PointF point7 = PointF(250.0F,250.0F);
      array<PointF>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};

      // Draw lines between original points to screen.
      e->Graphics->DrawLines( redPen, curvePoints );

      // Create offset and number of segments.
      int offset = 2;
      int numSegments = 4;

      // Draw curve to screen.
      e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments );
   }
private void DrawCurvePointFSegments(PaintEventArgs e)
{

    // Create pens.
    Pen redPen = new Pen(Color.Red, 3);
    Pen greenPen = new Pen(Color.Green, 3);

    // Create points that define curve.
    PointF point1 = new PointF(50.0F, 50.0F);
    PointF point2 = new PointF(100.0F, 25.0F);
    PointF point3 = new PointF(200.0F, 5.0F);
    PointF point4 = new PointF(250.0F, 50.0F);
    PointF point5 = new PointF(300.0F, 100.0F);
    PointF point6 = new PointF(350.0F, 200.0F);
    PointF point7 = new PointF(250.0F, 250.0F);
    PointF[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};

    // Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints);

    // Create offset and number of segments.
    int offset = 2;
    int numSegments = 4;

    // Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments);
}
Private Sub DrawCurvePointFSegments(ByVal e As PaintEventArgs)

    ' Create pens.
    Dim redPen As New Pen(Color.Red, 3)
    Dim greenPen As New Pen(Color.Green, 3)

    ' Create points that define curve.
    Dim point1 As New PointF(50.0F, 50.0F)
    Dim point2 As New PointF(100.0F, 25.0F)
    Dim point3 As New PointF(200.0F, 5.0F)
    Dim point4 As New PointF(250.0F, 50.0F)
    Dim point5 As New PointF(300.0F, 100.0F)
    Dim point6 As New PointF(350.0F, 200.0F)
    Dim point7 As New PointF(250.0F, 250.0F)
    Dim curvePoints As PointF() = {point1, point2, point3, point4, _
    point5, point6, point7}

    ' Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints)

    ' Create offset and number of segments.
    Dim offset As Integer = 2
    Dim numSegments As Integer = 4

    ' Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments)
End Sub

Comentarios

Este método dibuja una curva spline cardinal que pasa a través de cada punto de la matriz.This method draws a cardinal spline that passes through each point in the array.

La matriz de puntos debe contener al menos tres PointF estructuras para dibujar una curva.The array of points must contain at least three PointF structures for a curve to be drawn.

El valor del offset parámetro especifica el número de elementos que se van a omitir en la matriz.The value of the offset parameter specifies the number of elements to skip in the array. El primer elemento después de los elementos omitidos representa el punto inicial de la curva.The first element after the skipped elements represents the starting point of the curve.

El valor del numberOfSegments parámetro especifica el número de segmentos, después del punto inicial, que se van a dibujar en la curva.The value of the numberOfSegments parameter specifies the number of segments, after the starting point, to draw in the curve. El valor del numberOfSegments parámetro debe ser al menos 1.The value of the numberOfSegments parameter must be at least 1. El valor del offset parámetro más el valor numberOfSegments del parámetro debe ser menor que el número de elementos de la matriz del points parámetro.The value of the offset parameter plus the value of the numberOfSegments parameter must be less than the number of elements in the array of the points parameter.

Este método usa una tensión predeterminada de 0,5.This method uses a default tension of 0.5.

DrawCurve(Pen, Point[], Int32, Int32, Single) DrawCurve(Pen, Point[], Int32, Int32, Single) DrawCurve(Pen, Point[], Int32, Int32, Single)

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras Point, usando la tensión especificada.Draws a cardinal spline through a specified array of Point structures using a specified tension.

public:
 void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Point> ^ points, int offset, int numberOfSegments, float tension);
public void DrawCurve (System.Drawing.Pen pen, System.Drawing.Point[] points, int offset, int numberOfSegments, float tension);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.Point[] * int * int * single -> unit

Parámetros

pen
Pen Pen Pen

Pen que determina el color, ancho y estilo de la curva.Pen that determines the color, width, and style of the curve.

points
Point[]

Matriz de estructuras Point que definen la curva spline.Array of Point structures that define the spline.

offset
Int32 Int32 Int32

Desplazamiento entre el primer elemento de la matriz del parámetro points y el punto inicial de la curva.Offset from the first element in the array of the points parameter to the starting point in the curve.

numberOfSegments
Int32 Int32 Int32

Número de segmentos posteriores al punto inicial que se incluirán en la curva.Number of segments after the starting point to include in the curve.

tension
Single Single Single

Valor mayor o igual que 0,0F que especifica la tensión de la curva.Value greater than or equal to 0.0F that specifies the tension of the curve.

Excepciones

pen es null.pen is null.

O bien-or- points es null.points is null.

Ejemplos

El siguiente ejemplo de código está diseñado para su uso con Windows Forms y requiere PaintEventArgs e, que Paint es un parámetro del controlador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. El código realiza las siguientes acciones:The code performs the following actions:

  • Crea bolígrafos rojos y verdes.Creates red and green pens.

  • Crea siete puntos para definir una curva.Creates seven points to define a curve.

  • Dibuja seis líneas rectas rojas entre los siete puntos para formar un polígono incompleto.Draws six red straight lines between the seven points to form an incomplete polygon.

  • Define el desplazamiento del punto inicial y el número de segmentos.Defines the starting point offset and number of segments.

  • Define la tensión.Defines the tension.

  • Dibuja una curva verde abierta (a partir del tercer punto) a través de los cinco últimos puntos.Draws an open green curve (starting at the third point) through the last five points.

El método establece la tensión en 1,0.The method sets the tension to 1.0.

private:
   void DrawCurvePointSegmentTension( PaintEventArgs^ e )
   {
      // Create pens.
      Pen^ redPen = gcnew Pen( Color::Red,3.0f );
      Pen^ greenPen = gcnew Pen( Color::Green,3.0f );

      // Create points that define curve.
      Point point1 = Point(50,50);
      Point point2 = Point(100,25);
      Point point3 = Point(200,5);
      Point point4 = Point(250,50);
      Point point5 = Point(300,100);
      Point point6 = Point(350,200);
      Point point7 = Point(250,250);
      array<Point>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};

      // Draw lines between original points to screen.
      e->Graphics->DrawLines( redPen, curvePoints );

      // Create offset, number of segments, and tension.
      int offset = 2;
      int numSegments = 4;
      float tension = 1.0F;

      // Draw curve to screen.
      e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments, tension );
   }
private void DrawCurvePointSegmentTension(PaintEventArgs e)
{

    // Create pens.
    Pen redPen = new Pen(Color.Red, 3);
    Pen greenPen = new Pen(Color.Green, 3);

    // Create points that define curve.
    Point point1 = new Point(50, 50);
    Point point2 = new Point(100, 25);
    Point point3 = new Point(200, 5);
    Point point4 = new Point(250, 50);
    Point point5 = new Point(300, 100);
    Point point6 = new Point(350, 200);
    Point point7 = new Point(250, 250);
    Point[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};

    // Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints);

    // Create offset, number of segments, and tension.
    int offset = 2;
    int numSegments = 4;
    float tension = 1.0F;

    // Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);
}
Private Sub DrawCurvePointSegmentTension(ByVal e As PaintEventArgs)

    ' Create pens.
    Dim redPen As New Pen(Color.Red, 3)
    Dim greenPen As New Pen(Color.Green, 3)

    ' Create points that define curve.
    Dim point1 As New Point(50, 50)
    Dim point2 As New Point(100, 25)
    Dim point3 As New Point(200, 5)
    Dim point4 As New Point(250, 50)
    Dim point5 As New Point(300, 100)
    Dim point6 As New Point(350, 200)
    Dim point7 As New Point(250, 250)
    Dim curvePoints As Point() = {point1, point2, point3, point4, _
    point5, point6, point7}

    ' Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints)

    ' Create offset, number of segments, and tension.
    Dim offset As Integer = 2
    Dim numSegments As Integer = 4
    Dim tension As Single = 1.0F

    ' Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, _
    tension)
End Sub

Comentarios

Este método dibuja una curva spline cardinal que pasa a través de cada punto de la matriz.This method draws a cardinal spline that passes through each point in the array.

La matriz de puntos debe contener al menos tres Point estructuras para dibujar una curva.The array of points must contain at least three Point structures for a curve to be drawn.

El valor del offset parámetro especifica el número de elementos que se van a omitir en la matriz.The value of the offset parameter specifies the number of elements to skip in the array. El primer elemento después de los elementos omitidos representa el punto inicial de la curva.The first element after the skipped elements represents the starting point of the curve.

El valor del numberOfSegments parámetro especifica el número de segmentos, después del punto inicial, que se van a dibujar en la curva.The value of the numberOfSegments parameter specifies the number of segments, after the starting point, to draw in the curve. El valor del numberOfSegments parámetro debe ser al menos 1.The value of the numberOfSegments parameter must be at least 1. El valor del offset parámetro más el valor numberOfSegments del parámetro debe ser menor que el número de elementos de la matriz del points parámetro.The value of the offset parameter plus the value of the numberOfSegments parameter must be less than the number of elements in the array of the points parameter.

El tension parámetro determina la forma de la curva spline.The tension parameter determines the shape of the spline. Si el valor del tension parámetro es 0,0 f, este método dibuja segmentos de línea recta para conectar los puntos.If the value of the tension parameter is 0.0F, this method draws straight line segments to connect the points. Normalmente, el tension parámetro es menor o igual que 1,0 f.Usually, the tension parameter is less than or equal to 1.0F. Los valores superiores a 1.0 F producen resultados poco habituales.Values over 1.0F produce unusual results.

DrawCurve(Pen, PointF[], Int32, Int32, Single) DrawCurve(Pen, PointF[], Int32, Int32, Single) DrawCurve(Pen, PointF[], Int32, Int32, Single)

Dibuja una curva spline cardinal a través de una matriz especificada de estructuras PointF, usando la tensión especificada.Draws a cardinal spline through a specified array of PointF structures using a specified tension. El dibujo comienza su desplazamiento a partir del comienzo de la matriz.The drawing begins offset from the beginning of the array.

public:
 void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points, int offset, int numberOfSegments, float tension);
public void DrawCurve (System.Drawing.Pen pen, System.Drawing.PointF[] points, int offset, int numberOfSegments, float tension);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.PointF[] * int * int * single -> unit

Parámetros

pen
Pen Pen Pen

Pen que determina el color, ancho y estilo de la curva.Pen that determines the color, width, and style of the curve.

points
PointF[]

Matriz de estructuras PointF que definen la curva spline.Array of PointF structures that define the spline.

offset
Int32 Int32 Int32

Desplazamiento entre el primer elemento de la matriz del parámetro points y el punto inicial de la curva.Offset from the first element in the array of the points parameter to the starting point in the curve.

numberOfSegments
Int32 Int32 Int32

Número de segmentos posteriores al punto inicial que se incluirán en la curva.Number of segments after the starting point to include in the curve.

tension
Single Single Single

Valor mayor o igual que 0,0F que especifica la tensión de la curva.Value greater than or equal to 0.0F that specifies the tension of the curve.

Excepciones

pen es null.pen is null.

o bien-or- points es null.points is null.

Ejemplos

El siguiente ejemplo de código está diseñado para su uso con Windows Forms y requiere PaintEventArgs e, que Paint es un parámetro del controlador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. El código realiza las siguientes acciones:The code performs the following actions:

  • Crea bolígrafos rojos y verdes.Creates red and green pens.

  • Crea siete puntos para definir una curva.Creates seven points to define a curve.

  • Dibuja seis líneas rectas rojas entre los siete puntos para formar un polígono incompleto.Draws six red straight lines between the seven points to form an incomplete polygon.

  • Define el desplazamiento del punto inicial y el número de segmentos.Defines the starting point offset and number of segments.

  • Define la tensión.Defines the tension.

  • Dibuja una curva verde abierta (a partir del tercer punto) a través de los cinco últimos puntos.Draws an open green curve (starting at the third point) through the last five points.

El método establece la tensión en 1,0.The method sets the tension to 1.0.

private:
   void DrawCurvePointFSegmentTension( PaintEventArgs^ e )
   {
      // Create pens.
      Pen^ redPen = gcnew Pen( Color::Red,3.0f );
      Pen^ greenPen = gcnew Pen( Color::Green,3.0f );

      // Create points that define curve.
      PointF point1 = PointF(50.0F,50.0F);
      PointF point2 = PointF(100.0F,25.0F);
      PointF point3 = PointF(200.0F,5.0F);
      PointF point4 = PointF(250.0F,50.0F);
      PointF point5 = PointF(300.0F,100.0F);
      PointF point6 = PointF(350.0F,200.0F);
      PointF point7 = PointF(250.0F,250.0F);
      array<PointF>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};

      // Draw lines between original points to screen.
      e->Graphics->DrawLines( redPen, curvePoints );

      // Create offset, number of segments, and tension.
      int offset = 2;
      int numSegments = 4;
      float tension = 1.0F;

      // Draw curve to screen.
      e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments, tension );
   }
private void DrawCurvePointFSegmentTension(PaintEventArgs e)
{

    // Create pens.
    Pen redPen = new Pen(Color.Red, 3);
    Pen greenPen = new Pen(Color.Green, 3);

    // Create points that define curve.
    PointF point1 = new PointF(50.0F, 50.0F);
    PointF point2 = new PointF(100.0F, 25.0F);
    PointF point3 = new PointF(200.0F, 5.0F);
    PointF point4 = new PointF(250.0F, 50.0F);
    PointF point5 = new PointF(300.0F, 100.0F);
    PointF point6 = new PointF(350.0F, 200.0F);
    PointF point7 = new PointF(250.0F, 250.0F);
    PointF[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};

    // Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints);

    // Create offset, number of segments, and tension.
    int offset = 2;
    int numSegments = 4;
    float tension = 1.0F;

    // Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);
}
Private Sub DrawCurvePointFSegmentTension(ByVal e As PaintEventArgs)

    ' Create pens.
    Dim redPen As New Pen(Color.Red, 3)
    Dim greenPen As New Pen(Color.Green, 3)

    ' Create points that define curve.
    Dim point1 As New PointF(50.0F, 50.0F)
    Dim point2 As New PointF(100.0F, 25.0F)
    Dim point3 As New PointF(200.0F, 5.0F)
    Dim point4 As New PointF(250.0F, 50.0F)
    Dim point5 As New PointF(300.0F, 100.0F)
    Dim point6 As New PointF(350.0F, 200.0F)
    Dim point7 As New PointF(250.0F, 250.0F)
    Dim curvePoints As PointF() = {point1, point2, point3, point4, _
    point5, point6, point7}

    ' Draw lines between original points to screen.
    e.Graphics.DrawLines(redPen, curvePoints)

    ' Create offset, number of segments, and tension.
    Dim offset As Integer = 2
    Dim numSegments As Integer = 4
    Dim tension As Single = 1.0F

    ' Draw curve to screen.
    e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, _
    tension)
End Sub

Comentarios

Este método dibuja una curva spline cardinal que pasa a través de cada punto de la matriz.This method draws a cardinal spline that passes through each point in the array.

La matriz de puntos debe contener al menos tres PointF estructuras para dibujar la curva.The array of points must contain at least three PointF structures for curve to be drawn.

El valor del offset parámetro especifica el número de elementos que se van a omitir en la matriz.The value of the offset parameter specifies the number of elements to skip in the array. El primer elemento después de los elementos omitidos representa el punto inicial de la curva.The first element after the skipped elements represents the starting point of the curve.

El valor del numberOfSegments parámetro especifica el número de segmentos, después del punto inicial, que se van a dibujar en la curva.The value of the numberOfSegments parameter specifies the number of segments, after the starting point, to draw in the curve. El valor del numberOfSegments parámetro debe ser al menos 1.The value of the numberOfSegments parameter must be at least 1. El valor del offset parámetro más el valor numberOfSegments del parámetro debe ser menor que el número de elementos de la matriz del points parámetro.The value of the offset parameter plus the value of the numberOfSegments parameter must be less than the number of elements in the array of the points parameter.

El tension parámetro determina la forma de la curva spline.The tension parameter determines the shape of the spline. Si el valor del tension parámetro es 0,0 f, este método dibuja segmentos de línea recta para conectar los puntos.If the value of the tension parameter is 0.0F, this method draws straight line segments to connect the points. Normalmente, el tension parámetro es menor o igual que 1,0 f.Usually, the tension parameter is less than or equal to 1.0F. Los valores superiores a 1.0 F producen resultados poco habituales.Values over 1.0F produce unusual results.

Se aplica a