Questo articolo è stato tradotto automaticamente. Per visualizzare l'articolo in inglese, selezionare la casella di controllo Inglese. È possibile anche visualizzare il testo inglese in una finestra popup posizionando il puntatore del mouse sopra il testo.
Traduzione
Inglese

Metodo Graphics.DrawClosedCurve (Pen, PointF[])

 

Data di pubblicazione: ottobre 2016

Disegna una spline di tipo Cardinal chiusa, definita da una matrice di strutture PointF.

Spazio dei nomi:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

public void DrawClosedCurve(
	Pen pen,
	PointF[] points
)

Parametri

pen
Type: System.Drawing.Pen

Oggetto Pen che determina il colore, la larghezza e l'altezza della curva.

points
Type: System.Drawing.PointF[]

Matrice di strutture PointF che definiscono la spline.

Exception Condition
ArgumentNullException

pen è null.

-oppure-

points è null.

This method draws a closed cardinal spline that passes through each point in the array. If the last point does not match the first point, an additional curve segment is added from the last point to the first point to close it.

The array of points must contain at least four T:System.Drawing.PointF structures.

This method uses a default tension of 0.5.

The following code example is designed for use with Windows Forms, and it requires T:System.Windows.Forms.PaintEventArgse, which is a parameter of the E:System.Windows.Forms.Control.Paint event handler. The code performs the following actions:

  • Creates red and green pens.

  • Creates seven points to define a curve.

  • Draws seven red straight lines between the seven points to form a closed polygon.

  • Draws a green closed curve through the seven points.

The method uses a default tension of 0.5.

private void DrawClosedCurvePointF(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 closed curve to screen.
    e.Graphics.DrawClosedCurve(greenPen, curvePoints);
}

.NET Framework
Disponibile da 1.1
Torna all'inizio
Mostra: