Graphics.DrawLinesとは? わかりやすく解説

Graphics.DrawLines メソッド (Pen, Point[])

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

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub DrawLines ( _
    pen As Pen, _
    points As Point() _
)
public void DrawLines (
    Pen pen,
    Point[] points
)
public:
void DrawLines (
    Pen^ pen, 
    array<Point>^ points
)
public void DrawLines (
    Pen pen, 
    Point[] points
)
public function DrawLines (
    pen : Pen, 
    points : Point[]
)

パラメータ

pen

線分の色、幅、およびスタイルを決定する Pen。

points

接続する複数の点を表す Point 構造体の配列。

例外例外
例外の種類条件

ArgumentNullException

pen が null 参照 (Visual Basic では Nothing) です。

または

points が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

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

Public Sub DrawLinesPoint(ByVal
 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
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);
}
public:
   void DrawLinesPoint( PaintEventArgs^ e )
   {
      // Create pen.
      Pen^ pen = gcnew Pen( Color::Black,3.0f );

      // Create array of points that define lines to draw.
      array<Point>^ points = {Point(10,10),Point(10,100),Point(200,50),Point(250
,300)};

      //Draw lines to screen.
      e->Graphics->DrawLines( pen, points );
   }
public void DrawLinesPoint(PaintEventArgs e)
 
{
    // Create pen.
    Pen pen =  new Pen(Color.get_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.get_Graphics().DrawLines(pen, points);
} //DrawLinesPoint
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

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

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

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub DrawLines ( _
    pen As Pen, _
    points As PointF() _
)
Dim instance As Graphics
Dim pen As Pen
Dim points As PointF()

instance.DrawLines(pen, points)
public void DrawLines (
    Pen pen,
    PointF[] points
)
public:
void DrawLines (
    Pen^ pen, 
    array<PointF>^ points
)
public void DrawLines (
    Pen pen, 
    PointF[] points
)
public function DrawLines (
    pen : Pen, 
    points : PointF[]
)

パラメータ

pen

線分の色、幅、およびスタイルを決定する Pen。

points

接続する複数の点を表す PointF 構造体の配列。

例外例外
例外の種類条件

ArgumentNullException

pen が null 参照 (Visual Basic では Nothing) です。

または

points が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

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

Public Sub DrawLinesPointF(ByVal
 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(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(blackPen, points)
End Sub
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);
}
public:
   void DrawLinesPointF( PaintEventArgs^ e )
   {
      // Create pen.
      Pen^ pen = gcnew Pen( Color::Black,3.0f );

      // Create array of points that define lines to draw.
      array<PointF>^ points = {PointF(10.0F,10.0F),PointF(10.0F,100.0F),PointF(200.0F
,50.0F),PointF(250.0F,300.0F)};

      //Draw lines to screen.
      e->Graphics->DrawLines( pen, points );
   }
public void DrawLinesPointF(PaintEventArgs
 e) 
{
    // Create pen.
    Pen pen =  new Pen(Color.get_Black(), 3);

    // Create array of points that define lines to draw.
    PointF points[] =  {new PointF(10, 10), new
 PointF(10, 100), 
                        new PointF(200, 50), new
 PointF(250, 300)};

    //Draw lines to screen.
    e.get_Graphics().DrawLines(pen, points);
} //DrawLinesPointF
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.DrawLines メソッド




英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「Graphics.DrawLines」の関連用語

Graphics.DrawLinesのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Graphics.DrawLinesのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS