Point 構造体の配列を接続する一連の線分を描画します。
Overloads Public Sub DrawLines( _
ByVal pen As Pen, _ ByVal points() As Point _)
[C#]
public void DrawLines(Penpen,Point[] points);
[C++]
public: void DrawLines(Pen* pen,Pointpoints[]);
[JScript]
public function DrawLines(
pen : Pen,points : Point[]);
パラメータ
戻り値
このメソッドは値を返しません。
解説
このメソッドは、終了点の配列を接続する一連の直線を描画します。配列の最初の 2 つの点によって最初の直線が指定されます。それ以降の各点によって、前の線分の終了点を開始点とする線分の末尾が指定されます。
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
- 黒いペンを作成します。
- 直線の線分の点の配列を作成します。
- 接続された線分を画面に描画します。
Public Sub DrawLinesPoint(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 Point() = {New Point(10, 10), New Point(10, 100), _
New Point(200, 50), New Point(250, 300)}
'Draw lines to screen.
e.Graphics.DrawLines(blackPen, points)
End Sub
[C#]
public void DrawLinesPoint(PaintEventArgs e)
{
// Create pen.
Pen pen = new Pen(Color.Black, 3);
// Create array of points that define lines to draw.
Point[] points =
{
new Point( 10, 10),
new Point( 10, 100),
new Point(200, 50),
new Point(250, 300)
};
//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 オーバーロードの一覧