共用方式為


Graphics.DrawClosedCurve 方法

定義

繪製由 Point 結構數位定義的封閉基數曲線。

多載

DrawClosedCurve(Pen, ReadOnlySpan<Point>, Single, FillMode)
DrawClosedCurve(Pen, PointF[], Single, FillMode)

使用指定的緊張,繪製由 PointF 結構陣列所定義的封閉基數曲線。

DrawClosedCurve(Pen, Point[], Single, FillMode)

使用指定的緊張,繪製由 Point 結構陣列所定義的封閉基數曲線。

DrawClosedCurve(Pen, ReadOnlySpan<PointF>, Single, FillMode)
DrawClosedCurve(Pen, ReadOnlySpan<Point>)
DrawClosedCurve(Pen, Point[])

繪製由 Point 結構數位定義的封閉基數曲線。

DrawClosedCurve(Pen, ReadOnlySpan<PointF>)
DrawClosedCurve(Pen, PointF[])

繪製由 PointF 結構數位定義的封閉基數曲線。

DrawClosedCurve(Pen, ReadOnlySpan<Point>, Single, FillMode)

來源:
Graphics.cs
來源:
Graphics.cs
public:
 void DrawClosedCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points, float tension, System::Drawing::Drawing2D::FillMode fillmode);
public void DrawClosedCurve (System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.Point> points, float tension, System.Drawing.Drawing2D.FillMode fillmode);
member this.DrawClosedCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Point> * single * System.Drawing.Drawing2D.FillMode -> unit
Public Sub DrawClosedCurve (pen As Pen, points As ReadOnlySpan(Of Point), tension As Single, fillmode As FillMode)

參數

pen
Pen
tension
Single
fillmode
FillMode

適用於

DrawClosedCurve(Pen, PointF[], Single, FillMode)

來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs

使用指定的緊張,繪製由 PointF 結構陣列所定義的封閉基數曲線。

public:
 void DrawClosedCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points, float tension, System::Drawing::Drawing2D::FillMode fillmode);
public void DrawClosedCurve (System.Drawing.Pen pen, System.Drawing.PointF[] points, float tension, System.Drawing.Drawing2D.FillMode fillmode);
member this.DrawClosedCurve : System.Drawing.Pen * System.Drawing.PointF[] * single * System.Drawing.Drawing2D.FillMode -> unit
Public Sub DrawClosedCurve (pen As Pen, points As PointF(), tension As Single, fillmode As FillMode)

參數

pen
Pen

Pen,決定曲線的色彩、寬度和高度。

points
PointF[]

定義曲線之 PointF 結構的數位。

tension
Single

大於或等於 0.0F 的值,指定曲線的緊張度。

fillmode
FillMode

決定曲線填滿方式之 FillMode 列舉的成員。 這是必要參數,但會被忽略。

例外狀況

pen null

-或-

points null

範例

下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse,這是 Paint 事件處理程式的參數。 程式代碼會執行下列動作:

  • 建立紅色和綠色的畫筆。

  • 建立七個點來定義曲線。

  • 在七點之間繪製七條紅色直線,以形成多邊形。

  • 建立緊張和填滿模式設定。

  • 透過七點繪製綠色封閉曲線。

方法會使用 1.0 的緊張,並將填滿模式設定為 FillMode.Alternate

private:
   void DrawClosedCurvePointFTension( 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 and fill mode.
      float tension = 1.0F;
      FillMode aFillMode = FillMode::Alternate;

      // Draw closed curve to screen.
      e->Graphics->DrawClosedCurve( greenPen, curvePoints, tension, aFillMode );
   }
private void DrawClosedCurvePointFTension(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 and fill mode.
    float tension = 1.0F;
    FillMode aFillMode = FillMode.Alternate;

    // Draw closed curve to screen.
    e.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);
}
Private Sub DrawClosedCurvePointFTension(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 and fill mode.
    Dim tension As Single = 1.0F
    Dim aFillMode As FillMode = FillMode.Alternate

    ' Draw closed curve to screen.
    e.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, _
    aFillMode)
End Sub

備註

這個方法會繪製封閉的基數曲線,該曲線會通過數位中的每個點。 如果最後一個點不符合第一個點,則會從最後一個點新增到第一個點以關閉它的額外曲線線段。

點陣陣必須至少包含四個 PointF 結構。

tension 參數會決定曲線的形狀。 如果 tension 參數的值是 0.0F,這個方法會繪製直線線段來連接點。 通常,tension 參數小於或等於1.0F。 超過 1.0F 的值會產生不尋常的結果。

適用於

DrawClosedCurve(Pen, Point[], Single, FillMode)

來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs

使用指定的緊張,繪製由 Point 結構陣列所定義的封閉基數曲線。

public:
 void DrawClosedCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Point> ^ points, float tension, System::Drawing::Drawing2D::FillMode fillmode);
public void DrawClosedCurve (System.Drawing.Pen pen, System.Drawing.Point[] points, float tension, System.Drawing.Drawing2D.FillMode fillmode);
member this.DrawClosedCurve : System.Drawing.Pen * System.Drawing.Point[] * single * System.Drawing.Drawing2D.FillMode -> unit
Public Sub DrawClosedCurve (pen As Pen, points As Point(), tension As Single, fillmode As FillMode)

參數

pen
Pen

Pen,決定曲線的色彩、寬度和高度。

points
Point[]

定義曲線之 Point 結構的數位。

tension
Single

大於或等於 0.0F 的值,指定曲線的緊張度。

fillmode
FillMode

決定曲線填滿方式之 FillMode 列舉的成員。 這是必要參數,但會被忽略。

例外狀況

pen null

-或-

points null

範例

下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse,這是 Paint 事件處理程式的參數。 程式代碼會執行下列動作:

  • 建立紅色和綠色的畫筆。

  • 建立七個點來定義曲線。

  • 在七點之間繪製七條紅色直線,以形成多邊形。

  • 建立緊張和填滿模式設定。

  • 透過七點繪製綠色封閉曲線。

方法會使用 1.0 的緊張,並將填滿模式設定為 FillMode.Alternate

private:
   void DrawClosedCurvePointTension( 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 and fill mode.
      float tension = 1.0F;
      FillMode aFillMode = FillMode::Alternate;

      // Draw closed curve to screen.
      e->Graphics->DrawClosedCurve( greenPen, curvePoints, tension, aFillMode );
   }
private void DrawClosedCurvePointTension(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 and fill mode.
    float tension = 1.0F;
    FillMode aFillMode = FillMode.Alternate;

    // Draw closed curve to screen.
    e.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);
}
Private Sub DrawClosedCurvePointTension(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 and fill mode.
    Dim tension As Single = 1.0F
    Dim aFillMode As FillMode = FillMode.Alternate

    ' Draw closed curve to screen.
    e.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, _
    aFillMode)
End Sub

備註

這個方法會繪製封閉的基數曲線,該曲線會通過數位中的每個點。 如果最後一個點不符合第一個點,則會從最後一個點新增到第一個點以關閉它的額外曲線線段。

點陣陣必須至少包含四個 Point 結構。

tension 參數會決定曲線的形狀。 如果 tension 參數的值是 0.0F,這個方法會繪製直線線段來連接點。 通常,tension 參數小於或等於1.0F。 超過 1.0F 的值會產生不尋常的結果。

適用於

DrawClosedCurve(Pen, ReadOnlySpan<PointF>, Single, FillMode)

來源:
Graphics.cs
來源:
Graphics.cs
public:
 void DrawClosedCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points, float tension, System::Drawing::Drawing2D::FillMode fillmode);
public void DrawClosedCurve (System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.PointF> points, float tension, System.Drawing.Drawing2D.FillMode fillmode);
member this.DrawClosedCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> * single * System.Drawing.Drawing2D.FillMode -> unit
Public Sub DrawClosedCurve (pen As Pen, points As ReadOnlySpan(Of PointF), tension As Single, fillmode As FillMode)

參數

pen
Pen
tension
Single
fillmode
FillMode

適用於

DrawClosedCurve(Pen, ReadOnlySpan<Point>)

來源:
Graphics.cs
來源:
Graphics.cs
public:
 void DrawClosedCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points);
public void DrawClosedCurve (System.Drawing.Pen pen, scoped ReadOnlySpan<System.Drawing.Point> points);
member this.DrawClosedCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub DrawClosedCurve (pen As Pen, points As ReadOnlySpan(Of Point))

參數

pen
Pen

適用於

DrawClosedCurve(Pen, Point[])

來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs

繪製由 Point 結構數位定義的封閉基數曲線。

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

參數

pen
Pen

Pen,決定曲線的色彩、寬度和高度。

points
Point[]

定義曲線之 Point 結構的數位。

例外狀況

pen null

-或-

points null

範例

下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse,這是 Paint 事件處理程式的參數。 程式代碼會執行下列動作:

  • 建立紅色和綠色的畫筆。

  • 建立七個點來定義曲線。

  • 在七點之間繪製七條紅色直線,形成封閉的多邊形。

  • 透過七點繪製綠色封閉曲線。

方法會使用預設的緊張度 0.5。

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

備註

這個方法會繪製封閉的基數曲線,該曲線會通過數位中的每個點。 如果最後一個點不符合第一個點,則會從最後一個點新增到第一個點以關閉圖形的額外曲線線段。

點陣陣必須至少包含四個 Point 結構。

此方法使用預設的緊張度 0.5。

適用於

DrawClosedCurve(Pen, ReadOnlySpan<PointF>)

來源:
Graphics.cs
來源:
Graphics.cs
public:
 void DrawClosedCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points);
public void DrawClosedCurve (System.Drawing.Pen pen, scoped ReadOnlySpan<System.Drawing.PointF> points);
member this.DrawClosedCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub DrawClosedCurve (pen As Pen, points As ReadOnlySpan(Of PointF))

參數

pen
Pen

適用於

DrawClosedCurve(Pen, PointF[])

來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs

繪製由 PointF 結構數位定義的封閉基數曲線。

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

參數

pen
Pen

Pen,決定曲線的色彩、寬度和高度。

points
PointF[]

定義曲線之 PointF 結構的數位。

例外狀況

pen null

-或-

points null

範例

下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse,這是 Paint 事件處理程式的參數。 程式代碼會執行下列動作:

  • 建立紅色和綠色的畫筆。

  • 建立七個點來定義曲線。

  • 在七點之間繪製七條紅色直線,形成封閉的多邊形。

  • 透過七點繪製綠色封閉曲線。

方法會使用預設的緊張度 0.5。

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

備註

這個方法會繪製封閉的基數曲線,該曲線會通過數位中的每個點。 如果最後一個點不符合第一個點,則會從最後一個點新增到第一個點以關閉它的額外曲線線段。

點陣陣必須至少包含四個 PointF 結構。

此方法使用預設的緊張度 0.5。

適用於