次の方法で共有


Graphics.DrawBezier メソッド (Pen, PointF, PointF, PointF, PointF)

4 つの PointF 構造体で定義されるベジエ スプラインを描画します。

Overloads Public Sub DrawBezier( _
   ByVal pen As Pen, _   ByVal pt1 As PointF, _   ByVal pt2 As PointF, _   ByVal pt3 As PointF, _   ByVal pt4 As PointF _)
[C#]
public void DrawBezier(Penpen,PointFpt1,PointFpt2,PointFpt3,PointFpt4);
[C++]
public: void DrawBezier(Pen* pen,PointFpt1,PointFpt2,PointFpt3,PointFpt4);
[JScript]
public function DrawBezier(
   pen : Pen,pt1 : PointF,pt2 : PointF,pt3 : PointF,pt4 : PointF);

パラメータ

  • pen
    曲線の色、幅、およびスタイルを決定する Pen オブジェクト。
  • pt1
    曲線の開始点を表す PointF 構造体。
  • pt2
    曲線の最初の制御点を表す PointF 構造体。
  • pt3
    曲線の 2 番目の制御点を表す PointF 構造体。
  • pt4
    曲線の終了点を表す PointF 構造体。

戻り値

このメソッドは値を返しません。

解説

ベジエ スプラインは、最初の点から 4 番目の点にかけて描画されます。2 番目と 3 番目の点は、曲線の形状を決定する制御点です。

使用例

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

  • 黒いペンを作成します。
  • 曲線の開始点、終了点、および 2 つの制御点を作成します。
  • 画面にベジエ曲線を描画します。
 
Public Sub DrawBezierPointF(e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create points for curve.
Dim start As New PointF(100F, 100F)
Dim control1 As New PointF(200F, 10F)
Dim control2 As New PointF(350F, 50F)
Dim [end] As New PointF(500F, 100F)
' Draw arc to screen.
e.Graphics.DrawBezier(blackPen, start, control1, control2, [end])
End Sub
        
[C#] 
public void DrawBezierPointF(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create points for curve.
PointF start = new PointF(100.0F, 100.0F);
PointF control1 = new PointF(200.0F, 10.0F);
PointF control2 = new PointF(350.0F, 50.0F);
PointF end = new PointF(500.0F, 100.0F);
// Draw arc to screen.
e.Graphics.DrawBezier(blackPen, start, control1, control2, end);
}
        

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

Graphics クラス | Graphics メンバ | System.Drawing 名前空間 | Graphics.DrawBezier オーバーロードの一覧