次の方法で共有


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

各点を表す 4 つの順序付けられた座標ペアで定義されるベジエ スプラインを描画します。

Overloads Public Sub DrawBezier( _
   ByVal pen As Pen, _   ByVal x1 As Single, _   ByVal y1 As Single, _   ByVal x2 As Single, _   ByVal y2 As Single, _   ByVal x3 As Single, _   ByVal y3 As Single, _   ByVal x4 As Single, _   ByVal y4 As Single _)
[C#]
public void DrawBezier(Penpen,floatx1,floaty1,floatx2,floaty2,floatx3,floaty3,floatx4,floaty4);
[C++]
public: void DrawBezier(Pen* pen,floatx1,floaty1,floatx2,floaty2,floatx3,floaty3,floatx4,floaty4);
[JScript]
public function DrawBezier(
   pen : Pen,x1 : float,y1 : float,x2 : float,y2 : float,x3 : float,y3 : float,x4 : float,y4 : float);

パラメータ

  • pen
    曲線の色、幅、およびスタイルを決定する Pen オブジェクト。
  • x1
    曲線の開始点の x 座標。
  • y1
    曲線の開始点の y 座標。
  • x2
    曲線の最初の制御点の x 座標。
  • y2
    曲線の最初の制御点の y 座標。
  • x3
    曲線の 2 番目の制御点の x 座標。
  • y3
    曲線の 2 番目の制御点の y 座標。
  • x4
    曲線の終了点の x 座標。
  • y4
    曲線の終了点の y 座標。

戻り値

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

解説

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

使用例

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

  • 黒いペンを作成します。
  • 曲線の開始点、終了点、および 2 つの制御点の座標を作成します。
  • 画面にベジエ曲線を描画します。
 
' Begin Example03.
Public Sub DrawBezierFloat(e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create coordinates of points for curve.
Dim startX As Single = 100F
Dim startY As Single = 100F
Dim controlX1 As Single = 200F
Dim controlY1 As Single = 10F
Dim controlX2 As Single = 350F
Dim controlY2 As Single = 50F
Dim endX As Single = 500F
Dim endY As Single = 100F
' Draw arc to screen.
e.Graphics.DrawBezier(blackPen, startX, startY, controlX1, _
controlY1, controlX2, controlY2, endX, endY)
End Sub
        
[C#] 
public void DrawBezierFloat(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create coordinates of points for curve.
float startX = 100.0F;
float startY = 100.0F;
float controlX1 = 200.0F;
float controlY1 =  10.0F;
float controlX2 = 350.0F;
float controlY2 =  50.0F;
float endX = 500.0F;
float endY = 100.0F;
// Draw arc to screen.
e.Graphics.DrawBezier(blackPen, startX, startY,
controlX1, controlY1,
controlX2, controlY2,
endX, endY);
}
        

[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 オーバーロードの一覧