次の方法で共有


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

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

Overloads Public Sub DrawBezier( _
   ByVal pen As Pen, _   ByVal pt1 As Point, _   ByVal pt2 As Point, _   ByVal pt3 As Point, _   ByVal pt4 As Point _)
[C#]
public void DrawBezier(Penpen,Pointpt1,Pointpt2,Pointpt3,Pointpt4);
[C++]
public: void DrawBezier(Pen* pen,Pointpt1,Pointpt2,Pointpt3,Pointpt4);
[JScript]
public function DrawBezier(
   pen : Pen,pt1 : Point,pt2 : Point,pt3 : Point,pt4 : Point);

パラメータ

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

戻り値

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

解説

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

使用例

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

  • 黒いペンを作成します。
  • 曲線の開始点、終了点、および 2 つの制御点を作成します。
  • 画面にベジエ曲線を描画します。
 
Public Sub DrawBezierPoint(e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create points for curve.
Dim start As New Point(100, 100)
Dim control1 As New Point(200, 10)
Dim control2 As New Point(350, 50)
Dim [end] As New Point(500, 100)
' Draw arc to screen.
e.Graphics.DrawBezier(blackPen, start, control1, control2, [end])
End Sub
        
[C#] 
public void DrawBezierPoint(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create points for curve.
Point start = new Point(100, 100);
Point control1 = new Point(200, 10);
Point control2 = new Point(350, 50);
Point end = new Point(500, 100);
// 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 オーバーロードの一覧