Graphics.DrawCurveとは? わかりやすく解説

Graphics.DrawCurve メソッド (Pen, PointF[], Single)

指定したテンションを使用して、指定した PointF 構造体の配列を通過するカーディナル スプラインを描画します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub DrawCurve ( _
    pen As Pen, _
    points As PointF(), _
    tension As Single _
)
public void DrawCurve (
    Pen pen,
    PointF[] points,
    float tension
)
public:
void DrawCurve (
    Pen^ pen, 
    array<PointF>^ points, 
    float tension
)
public void DrawCurve (
    Pen pen, 
    PointF[] points, 
    float tension
)
public function DrawCurve (
    pen : Pen, 
    points : PointF[], 
    tension : float
)

パラメータ

pen

曲線の色、幅、および高さを決定する Pen。

points

曲線を定義する複数の点を表す PointF 構造体の配列。

tension

曲線のテンションを指定する 0.0F 以上の値。

例外例外
例外の種類条件

ArgumentNullException

pen が null 参照 (Visual Basic では Nothing) です。

または

points が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。

このメソッドは、1.0 のテンションを使用します。

Public 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
public 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);
}
public:
   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 );
   }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.DrawCurve メソッド (Pen, Point[], Single)

指定したテンションを使用して、指定した Point 構造体の配列を通過するカーディナル スプラインを描画します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

例外例外
例外の種類条件

ArgumentNullException

pen が null 参照 (Visual Basic では Nothing) です。

または

points が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。

このメソッドは、1.0 のテンションを使用します。

Public 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
public 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);
}
public:
   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 );
   }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.DrawCurve メソッド (Pen, Point[])

指定した Point 構造体の配列を通過するカーディナル スプラインを描画します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub DrawCurve ( _
    pen As Pen, _
    points As Point() _
)
public void DrawCurve (
    Pen pen,
    Point[] points
)
public:
void DrawCurve (
    Pen^ pen, 
    array<Point>^ points
)
public void DrawCurve (
    Pen pen, 
    Point[] points
)
public function DrawCurve (
    pen : Pen, 
    points : Point[]
)

パラメータ

pen

曲線の色、幅、および高さを決定する Pen。

points

スプラインを定義する Point 構造体の配列。

例外例外
例外の種類条件

ArgumentNullException

pen が null 参照 (Visual Basic では Nothing) です。

または

points が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。

このメソッドは、既定のテンションである 0.5 を使用します。

Public 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
public 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);
}
public:
   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 );
   }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.DrawCurve メソッド (Pen, PointF[], Int32, Int32)

指定した PointF 構造体の配列を通過するカーディナル スプラインを描画します。この描画は、配列の先頭からのオフセットから開始されます。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub DrawCurve ( _
    pen As Pen, _
    points As PointF(), _
    offset As Integer, _
    numberOfSegments As Integer _
)
Dim instance As Graphics
Dim pen As Pen
Dim points As PointF()
Dim offset As Integer
Dim numberOfSegments As Integer

instance.DrawCurve(pen, points, offset, numberOfSegments)
public void DrawCurve (
    Pen pen,
    PointF[] points,
    int offset,
    int numberOfSegments
)
public:
void DrawCurve (
    Pen^ pen, 
    array<PointF>^ points, 
    int offset, 
    int numberOfSegments
)
public void DrawCurve (
    Pen pen, 
    PointF[] points, 
    int offset, 
    int numberOfSegments
)
public function DrawCurve (
    pen : Pen, 
    points : PointF[], 
    offset : int, 
    numberOfSegments : int
)

パラメータ

pen

曲線の色、幅、および高さを決定する Pen。

points

スプラインを定義する PointF 構造体の配列。

offset

points パラメータの配列の最初の要素から曲線の開始点までのオフセット。

numberOfSegments

曲線に含める開始点以降のセグメント数。

例外例外
例外の種類条件

ArgumentNullException

pen が null 参照 (Visual Basic では Nothing) です。

または

points が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。

このメソッドは、既定のテンションである 0.5 を使用します。

Public 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
public 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);
}
public:
   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 );
   }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.DrawCurve メソッド (Pen, Point[], Int32, Int32, Single)

指定したテンションを使用して、指定した Point 構造体の配列を通過するカーディナル スプラインを描画します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub DrawCurve ( _
    pen As Pen, _
    points As Point(), _
    offset As Integer, _
    numberOfSegments As Integer, _
    tension As Single _
)
Dim instance As Graphics
Dim pen As Pen
Dim points As Point()
Dim offset As Integer
Dim numberOfSegments As Integer
Dim tension As Single

instance.DrawCurve(pen, points, offset, numberOfSegments, tension)
public void DrawCurve (
    Pen pen,
    Point[] points,
    int offset,
    int numberOfSegments,
    float tension
)
public:
void DrawCurve (
    Pen^ pen, 
    array<Point>^ points, 
    int offset, 
    int numberOfSegments, 
    float tension
)
public void DrawCurve (
    Pen pen, 
    Point[] points, 
    int offset, 
    int numberOfSegments, 
    float tension
)
public function DrawCurve (
    pen : Pen, 
    points : Point[], 
    offset : int, 
    numberOfSegments : int, 
    tension : float
)

パラメータ

pen

曲線の色、幅、および高さを決定する Pen。

points

スプラインを定義する Point 構造体の配列。

offset

points パラメータの配列の最初の要素から曲線の開始点までのオフセット。

numberOfSegments

曲線に含める開始点以降のセグメント数。

tension

曲線のテンションを指定する 0.0F 以上の値。

例外例外
例外の種類条件

ArgumentNullException

pen が null 参照 (Visual Basic では Nothing) です。

または

points が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。

このメソッドは、テンションを 1.0 に設定します。

Public 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
public 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);
}
public:
   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
 );
   }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.DrawCurve メソッド

指定した Point 構造体の配列を通過するカーディナル スプラインを描画します。
オーバーロードの一覧オーバーロードの一覧

参照参照

Graphics.DrawCurve メソッド (Pen, PointF[])

指定した PointF 構造体の配列を通過するカーディナル スプラインを描画します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub DrawCurve ( _
    pen As Pen, _
    points As PointF() _
)
Dim instance As Graphics
Dim pen As Pen
Dim points As PointF()

instance.DrawCurve(pen, points)
public void DrawCurve (
    Pen pen,
    PointF[] points
)
public:
void DrawCurve (
    Pen^ pen, 
    array<PointF>^ points
)
public void DrawCurve (
    Pen pen, 
    PointF[] points
)
public function DrawCurve (
    pen : Pen, 
    points : PointF[]
)

パラメータ

pen

曲線の色、幅、および高さを決定する Pen。

points

スプラインを定義する PointF 構造体の配列。

例外例外
例外の種類条件

ArgumentNullException

pen が null 参照 (Visual Basic では Nothing) です。

または

points が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。

このメソッドは、既定のテンションである 0.5 を使用します。

Public 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
public 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);
}
public:
   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 );
   }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.DrawCurve メソッド (Pen, PointF[], Int32, Int32, Single)

指定したテンションを使用して、指定した PointF 構造体の配列を通過するカーディナル スプラインを描画します。この描画は、配列の先頭からのオフセットから開始されます。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub DrawCurve ( _
    pen As Pen, _
    points As PointF(), _
    offset As Integer, _
    numberOfSegments As Integer, _
    tension As Single _
)
Dim instance As Graphics
Dim pen As Pen
Dim points As PointF()
Dim offset As Integer
Dim numberOfSegments As Integer
Dim tension As Single

instance.DrawCurve(pen, points, offset, numberOfSegments, tension)
public void DrawCurve (
    Pen pen,
    PointF[] points,
    int offset,
    int numberOfSegments,
    float tension
)
public:
void DrawCurve (
    Pen^ pen, 
    array<PointF>^ points, 
    int offset, 
    int numberOfSegments, 
    float tension
)
public void DrawCurve (
    Pen pen, 
    PointF[] points, 
    int offset, 
    int numberOfSegments, 
    float tension
)
public function DrawCurve (
    pen : Pen, 
    points : PointF[], 
    offset : int, 
    numberOfSegments : int, 
    tension : float
)

パラメータ

pen

曲線の色、幅、および高さを決定する Pen。

points

スプラインを定義する PointF 構造体の配列。

offset

points パラメータの配列の最初の要素から曲線の開始点までのオフセット。

numberOfSegments

曲線に含める開始点以降のセグメント数。

tension

曲線のテンションを指定する 0.0F 以上の値。

例外例外
例外の種類条件

ArgumentNullException

pen が null 参照 (Visual Basic では Nothing) です。

または

points が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。

このメソッドは、テンションを 1.0 に設定します。

Public 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
public 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);
}
public:
   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
 );
   }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「Graphics.DrawCurve」の関連用語

Graphics.DrawCurveのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Graphics.DrawCurveのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS