Graphics.DrawCurve Metoda

Definicja

Rysuje kardynaną krzywą przez określoną tablicę Point struktur.

Przeciążenia

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

Rysuje kardynaną spline przez określoną tablicę PointF struktur przy użyciu określonego napięcia. Rysunek rozpoczyna przesunięcie od początku tablicy.

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

Rysuje kardynaną spline przez określoną tablicę Point struktur przy użyciu określonego napięcia.

DrawCurve(Pen, ReadOnlySpan<PointF>, Int32, Int32)
DrawCurve(Pen, PointF[], Int32, Int32)

Rysuje kardynaną linię przez określoną tablicę PointF struktur. Rysunek rozpoczyna przesunięcie od początku tablicy.

DrawCurve(Pen, PointF[], Single)

Rysuje kardynaną spline przez określoną tablicę PointF struktur przy użyciu określonego napięcia.

DrawCurve(Pen, Point[], Single)

Rysuje kardynaną spline przez określoną tablicę Point struktur przy użyciu określonego napięcia.

DrawCurve(Pen, ReadOnlySpan<PointF>)
DrawCurve(Pen, ReadOnlySpan<Point>)
DrawCurve(Pen, PointF[])

Rysuje kardynaną linię przez określoną tablicę PointF struktur.

DrawCurve(Pen, Point[])

Rysuje kardynaną linię przez określoną tablicę Point struktur.

DrawCurve(Pen, ReadOnlySpan<Point>, Single)

DrawCurve(Pen, ReadOnlySpan<PointF>, Single)

Źródło:
Graphics.cs
public:
 void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points, float tension);
public void DrawCurve (System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.PointF> points, float tension);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> * single -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of PointF), tension As Single)

Parametry

pen
Pen
tension
Single

Dotyczy

DrawCurve(Pen, ReadOnlySpan<PointF>, Int32, Int32, Single)

Źródło:
Graphics.cs
public:
 void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points, int offset, int numberOfSegments, float tension);
public void DrawCurve (System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.PointF> points, int offset, int numberOfSegments, float tension);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> * int * int * single -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of PointF), offset As Integer, numberOfSegments As Integer, tension As Single)

Parametry

pen
Pen
offset
Int32
numberOfSegments
Int32
tension
Single

Dotyczy

DrawCurve(Pen, ReadOnlySpan<Point>, Int32, Int32, Single)

Źródło:
Graphics.cs
public:
 void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points, int offset, int numberOfSegments, float tension);
public void DrawCurve (System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.Point> points, int offset, int numberOfSegments, float tension);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Point> * int * int * single -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of Point), offset As Integer, numberOfSegments As Integer, tension As Single)

Parametry

pen
Pen
offset
Int32
numberOfSegments
Int32
tension
Single

Dotyczy

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

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Rysuje kardynaną spline przez określoną tablicę PointF struktur przy użyciu określonego napięcia. Rysunek rozpoczyna przesunięcie od początku tablicy.

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
Public Sub DrawCurve (pen As Pen, points As PointF(), offset As Integer, numberOfSegments As Integer, tension As Single)

Parametry

pen
Pen

Pen określa kolor, szerokość i styl krzywej.

points
PointF[]

Tablica PointF struktur definiujących linię spline.

offset
Int32

Przesunięcie od pierwszego elementu w tablicy parametru points do punktu początkowego w krzywej.

numberOfSegments
Int32

Liczba segmentów po punkcie początkowym do uwzględnienia w krzywej.

tension
Single

Wartość większa niż lub równa 0,0F, która określa napięcie krzywej.

Wyjątki

pen to null.

-lub-

points to null.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy czerwone i zielone pióra.

  • Tworzy siedem punktów do zdefiniowania krzywej.

  • Rysuje sześć czerwonych linii prostych między siedmioma punktami, aby utworzyć niekompletny wielokąt.

  • Definiuje przesunięcie punktu początkowego i liczbę segmentów.

  • Definiuje napięcie.

  • Rysuje otwartą zieloną krzywą (począwszy od trzeciego punktu) przez ostatnie pięć punktów.

Metoda ustawia napięcie na 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

Uwagi

Ta metoda rysuje kardynaną linię, która przechodzi przez każdy punkt w tablicy.

Tablica punktów musi zawierać co najmniej trzy PointF struktury do narysowania krzywej.

Wartość parametru offset określa liczbę elementów do pominięcia w tablicy. Pierwszy element po pominiętych elementach reprezentuje punkt początkowy krzywej.

Wartość parametru numberOfSegments określa liczbę segmentów po punkcie początkowym do rysowania na krzywej. Wartość parametru numberOfSegments musi być co najmniej 1. Wartość parametru offset plus wartość numberOfSegments parametru musi być mniejsza niż liczba elementów w tablicy parametru points .

Parametr tension określa kształt linii spline. Jeśli wartość parametru tension wynosi 0,0F, ta metoda pobiera segmenty linii prostej w celu połączenia punktów. tension Zazwyczaj parametr jest mniejszy lub równy 1,0F. Wartości powyżej 1,0F generują nietypowe wyniki.

Dotyczy

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

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Rysuje kardynaną spline przez określoną tablicę Point struktur przy użyciu określonego napięcia.

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
Public Sub DrawCurve (pen As Pen, points As Point(), offset As Integer, numberOfSegments As Integer, tension As Single)

Parametry

pen
Pen

Pen określa kolor, szerokość i styl krzywej.

points
Point[]

Tablica Point struktur definiujących linię spline.

offset
Int32

Przesunięcie od pierwszego elementu w tablicy parametru points do punktu początkowego w krzywej.

numberOfSegments
Int32

Liczba segmentów po punkcie początkowym do uwzględnienia w krzywej.

tension
Single

Wartość większa niż lub równa 0,0F, która określa napięcie krzywej.

Wyjątki

pen to null.

-lub-

points to null.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy czerwone i zielone pióra.

  • Tworzy siedem punktów do zdefiniowania krzywej.

  • Rysuje sześć czerwonych linii prostych między siedmioma punktami, aby utworzyć niekompletny wielokąt.

  • Definiuje przesunięcie punktu początkowego i liczbę segmentów.

  • Definiuje napięcie.

  • Rysuje otwartą zieloną krzywą (począwszy od trzeciego punktu) przez ostatnie pięć punktów.

Metoda ustawia napięcie na 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

Uwagi

Ta metoda rysuje kardynaną linię, która przechodzi przez każdy punkt w tablicy.

Tablica punktów musi zawierać co najmniej trzy Point struktury do narysowania krzywej.

Wartość parametru offset określa liczbę elementów do pominięcia w tablicy. Pierwszy element po pominiętych elementach reprezentuje punkt początkowy krzywej.

Wartość parametru numberOfSegments określa liczbę segmentów po punkcie początkowym do rysowania na krzywej. Wartość parametru numberOfSegments musi być co najmniej 1. Wartość parametru offset plus wartość numberOfSegments parametru musi być mniejsza niż liczba elementów w tablicy parametru points .

Parametr tension określa kształt linii spline. Jeśli wartość parametru tension wynosi 0,0F, ta metoda pobiera segmenty linii prostej w celu połączenia punktów. tension Zazwyczaj parametr jest mniejszy lub równy 1,0F. Wartości powyżej 1,0F generują nietypowe wyniki.

Dotyczy

DrawCurve(Pen, ReadOnlySpan<PointF>, Int32, Int32)

Źródło:
Graphics.cs
public:
 void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points, int offset, int numberOfSegments);
public void DrawCurve (System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.PointF> points, int offset, int numberOfSegments);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> * int * int -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of PointF), offset As Integer, numberOfSegments As Integer)

Parametry

pen
Pen
offset
Int32
numberOfSegments
Int32

Dotyczy

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

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Rysuje kardynaną krzywą przez określoną tablicę PointF struktur. Rysunek rozpoczyna przesunięcie od początku tablicy.

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
Public Sub DrawCurve (pen As Pen, points As PointF(), offset As Integer, numberOfSegments As Integer)

Parametry

pen
Pen

Pen określa kolor, szerokość i styl krzywej.

points
PointF[]

Tablica PointF struktur definiujących linię spline.

offset
Int32

Przesunięcie od pierwszego elementu w tablicy parametru points do punktu początkowego w krzywej.

numberOfSegments
Int32

Liczba segmentów po punkcie początkowym do uwzględnienia w krzywej.

Wyjątki

pen to null.

-lub-

points to null.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy czerwone i zielone pióra.

  • Tworzy siedem punktów do zdefiniowania krzywej.

  • Rysuje sześć czerwonych linii prostych między siedmioma punktami, aby utworzyć niekompletny wielokąt.

  • Definiuje przesunięcie punktu początkowego i liczbę segmentów.

  • Rysuje otwartą zieloną krzywą (począwszy od trzeciego punktu) przez ostatnie pięć punktów.

Metoda używa domyślnego napięcia 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

Uwagi

Ta metoda rysuje kardynaną linię, która przechodzi przez każdy punkt w tablicy.

Tablica punktów musi zawierać co najmniej trzy PointF struktury do narysowania krzywej.

Wartość parametru offset określa liczbę elementów do pominięcia w tablicy. Pierwszy element po pominiętych elementach reprezentuje punkt początkowy krzywej.

Wartość parametru numberOfSegments określa liczbę segmentów, po punkcie początkowym, aby rysować na krzywej. Wartość parametru numberOfSegments musi wynosić co najmniej 1. Wartość parametru offset plus wartość parametru numberOfSegments musi być mniejsza niż liczba elementów w tablicy parametru points .

Ta metoda używa domyślnego napięcia 0,5.

Dotyczy

DrawCurve(Pen, PointF[], Single)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Rysuje kardynaną krzywą przez określoną tablicę PointF struktur przy użyciu określonego napięcia.

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
Public Sub DrawCurve (pen As Pen, points As PointF(), tension As Single)

Parametry

pen
Pen

Pen określa kolor, szerokość i styl krzywej.

points
PointF[]

Tablica PointF struktur reprezentujących punkty definiujące krzywą.

tension
Single

Wartość większa lub równa 0,0F, która określa napięcie krzywej.

Wyjątki

pen to null.

-lub-

points to null.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy czerwone i zielone pióra.

  • Tworzy siedem punktów do zdefiniowania krzywej.

  • Rysuje sześć czerwonych linii prostych między siedmioma punktami, aby utworzyć niekompletny wielokąt.

  • Tworzy ustawienie napięcia.

  • Rysuje otwartą zieloną zamkniętą krzywą przez siedem punktów.

Metoda używa napięcia 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

Uwagi

Ta metoda rysuje kardynaną krzywą, która przechodzi przez każdy punkt w tablicy.

Tablica punktów musi zawierać co najmniej trzy PointF struktury, aby można było narysować krzywą.

Parametr tension określa kształt krzywej. Jeśli wartość parametru tension to 0,0F, ta metoda rysuje segmenty linii prostej w celu połączenia punktów. tension Zazwyczaj parametr jest mniejszy lub równy 1,0F. Wartości powyżej 1.0F generują nietypowe wyniki.

Dotyczy

DrawCurve(Pen, Point[], Single)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Rysuje kardynaną krzywą przez określoną tablicę Point struktur przy użyciu określonego napięcia.

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
Public Sub DrawCurve (pen As Pen, points As Point(), tension As Single)

Parametry

pen
Pen

Pen określa kolor, szerokość i styl krzywej.

points
Point[]

Tablica Point struktur definiujących spline.

tension
Single

Wartość większa lub równa 0,0F, która określa napięcie krzywej.

Wyjątki

pen to null.

-lub-

points to null.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy czerwone i zielone pióra.

  • Tworzy siedem punktów do zdefiniowania krzywej.

  • Rysuje sześć czerwonych linii prostych między siedmioma punktami, aby utworzyć niekompletny wielokąt.

  • Tworzy ustawienie napięcia.

  • Rysuje otwartą zieloną zamkniętą krzywą przez siedem punktów.

Metoda używa napięcia 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

Uwagi

Ta metoda rysuje kardynaną krzywą, która przechodzi przez każdy punkt w tablicy.

Tablica punktów musi zawierać co najmniej trzy Point struktury, aby można było narysować krzywą.

Parametr tension określa kształt krzywej. Jeśli wartość parametru tension to 0,0F, ta metoda rysuje segmenty linii prostej w celu połączenia punktów. tension Zazwyczaj parametr jest mniejszy lub równy 1,0F. Wartości powyżej 1.0F generują nietypowe wyniki.

Dotyczy

DrawCurve(Pen, ReadOnlySpan<PointF>)

Źródło:
Graphics.cs
public:
 void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points);
public void DrawCurve (System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.PointF> points);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of PointF))

Parametry

pen
Pen

Dotyczy

DrawCurve(Pen, ReadOnlySpan<Point>)

Źródło:
Graphics.cs
public:
 void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points);
public void DrawCurve (System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.Point> points);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of Point))

Parametry

pen
Pen

Dotyczy

DrawCurve(Pen, PointF[])

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Rysuje kardynaną krzywą przez określoną tablicę PointF struktur.

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

Parametry

pen
Pen

Pen określa kolor, szerokość i styl krzywej.

points
PointF[]

Tablica PointF struktur definiujących spline.

Wyjątki

pen to null.

-lub-

points to null.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy czerwone i zielone pióra.

  • Tworzy siedem punktów do zdefiniowania krzywej.

  • Rysuje sześć czerwonych linii prostych między siedmioma punktami, aby utworzyć niekompletny wielokąt.

  • Rysuje otwartą zieloną krzywą przez siedem punktów.

Metoda używa domyślnego napięcia 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

Uwagi

Ta metoda rysuje kardynaną krzywą, która przechodzi przez każdy punkt w tablicy.

Tablica punktów musi zawierać co najmniej trzy PointF struktury, aby można było narysować krzywą.

Ta metoda używa domyślnego napięcia 0,5.

Dotyczy

DrawCurve(Pen, Point[])

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Rysuje kardynaną krzywą przez określoną tablicę Point struktur.

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

Parametry

pen
Pen

Pen określa kolor, szerokość i wysokość krzywej.

points
Point[]

Tablica Point struktur definiujących spline.

Wyjątki

pen to null.

-lub-

points to null.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy czerwone i zielone pióra.

  • Tworzy siedem punktów do zdefiniowania krzywej.

  • Rysuje sześć czerwonych linii prostych między siedmioma punktami, aby utworzyć niekompletny wielokąt.

  • Rysuje otwartą zieloną krzywą przez siedem punktów.

Metoda używa domyślnego napięcia 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

Uwagi

Ta metoda rysuje kardynaną krzywą, która przechodzi przez każdy punkt w tablicy.

Tablica punktów musi zawierać co najmniej trzy Point struktury, aby można było narysować krzywą.

Ta metoda używa domyślnego napięcia 0,5.

Dotyczy

DrawCurve(Pen, ReadOnlySpan<Point>, Single)

Źródło:
Graphics.cs
public:
 void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points, float tension);
public void DrawCurve (System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.Point> points, float tension);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Point> * single -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of Point), tension As Single)

Parametry

pen
Pen
tension
Single

Dotyczy