次の方法で共有


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

PointF 構造体の配列を接続する一連の線分を描画します。

Overloads Public Sub DrawLines( _
   ByVal pen As Pen, _   ByVal points() As PointF _)
[C#]
public void DrawLines(Penpen,PointF[] points);
[C++]
public: void DrawLines(Pen* pen,PointFpoints[]);
[JScript]
public function DrawLines(
   pen : Pen,points : PointF[]);

パラメータ

  • pen
    線分の色、幅、およびスタイルを決定する Pen オブジェクト。
  • points
    接続する複数の点を表す PointF 構造体の配列。

戻り値

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

解説

このメソッドは、終了点の配列を接続する一連の直線を描画します。配列の最初の 2 つの点によって最初の直線が指定されます。それ以降の各点によって、前の線分の終了点を開始点とする線分の末尾が指定されます。

使用例

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

  • 黒いペンを作成します。
  • 直線の線分の点の配列を作成します。
  • 接続された線分を画面に描画します。
 
Public Sub DrawLinesPointF(e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create array of points that define lines to draw.
Dim points As PointF() =  {New PointF(10F, 10F), _
New PointF(10F, 100F), New PointF(200F, 50F), _
New PointF(250F, 300F)}
'Draw lines to screen.
e.Graphics.DrawLines(blackPen, points)
End Sub
        
[C#] 
public void DrawLinesPointF(PaintEventArgs e)
{
// Create pen.
Pen pen = new Pen(Color.Black, 3);
// Create array of points that define lines to draw.
PointF[] points =
{
new PointF( 10.0F,  10.0F),
new PointF( 10.0F, 100.0F),
new PointF(200.0F,  50.0F),
new PointF(250.0F, 300.0F)
};
//Draw lines to screen.
e.Graphics.DrawLines(pen, points);
}
        

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