GraphicsPath.AddLineとは? わかりやすく解説

GraphicsPath.AddLine メソッド (Point, Point)

GraphicsPath に線分を追加します。

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

Public Sub AddLine ( _
    pt1 As Point, _
    pt2 As Point _
)
Dim instance As GraphicsPath
Dim pt1 As Point
Dim pt2 As Point

instance.AddLine(pt1, pt2)
public void AddLine (
    Point pt1,
    Point pt2
)
public:
void AddLine (
    Point pt1, 
    Point pt2
)
public void AddLine (
    Point pt1, 
    Point pt2
)
public function AddLine (
    pt1 : Point, 
    pt2 : Point
)

パラメータ

pt1

直線の開始点を表す Point。

pt2

直線の終了点を表す Point。

解説解説

このメソッドは、指定した点によって定義された線分を GraphicsPath の末尾に追加します。GraphicsPath に前回描画された直線や曲線がある場合は、そのパスの最後の点と新しい線分の最初の点を結ぶ線分が描画されます。

使用例使用例

例については、AddLine(Int32,Int32,Int32,Int32) のトピックを参照してください。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GraphicsPath クラス
GraphicsPath メンバ
System.Drawing.Drawing2D 名前空間

GraphicsPath.AddLine メソッド (Single, Single, Single, Single)

GraphicsPath に線分を追加します。

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

Public Sub AddLine ( _
    x1 As Single, _
    y1 As Single, _
    x2 As Single, _
    y2 As Single _
)
Dim instance As GraphicsPath
Dim x1 As Single
Dim y1 As Single
Dim x2 As Single
Dim y2 As Single

instance.AddLine(x1, y1, x2, y2)
public void AddLine (
    float x1,
    float y1,
    float x2,
    float y2
)
public:
void AddLine (
    float x1, 
    float y1, 
    float x2, 
    float y2
)
public void AddLine (
    float x1, 
    float y1, 
    float x2, 
    float y2
)
public function AddLine (
    x1 : float, 
    y1 : float, 
    x2 : float, 
    y2 : float
)

パラメータ

x1

直線の開始点の x 座標。

y1

直線の開始点の y 座標。

x2

直線の終了点の x 座標。

y2

直線の終了点の y 座標。

解説解説

このメソッドは、指定した点によって定義された線分を GraphicsPath の末尾に追加します。GraphicsPath に前回描画された直線や曲線がある場合は、そのパスの最後の点と新しい線分の最初の点を結ぶ線分が描画されます。

使用例使用例

例については、AddLine(Int32,Int32,Int32,Int32) のトピックを参照してください。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GraphicsPath クラス
GraphicsPath メンバ
System.Drawing.Drawing2D 名前空間

GraphicsPath.AddLine メソッド

GraphicsPath に線分を追加します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
GraphicsPath.AddLine (Point, Point) GraphicsPath に線分を追加します。
GraphicsPath.AddLine (PointF, PointF) GraphicsPath に線分を追加します。
GraphicsPath.AddLine (Int32, Int32, Int32, Int32) 現在の図形に線分を追加します。
GraphicsPath.AddLine (Single, Single, Single, Single) GraphicsPath に線分を追加します。
参照参照

関連項目

GraphicsPath クラス
GraphicsPath メンバ
System.Drawing.Drawing2D 名前空間

GraphicsPath.AddLine メソッド (PointF, PointF)

GraphicsPath に線分を追加します。

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

Public Sub AddLine ( _
    pt1 As PointF, _
    pt2 As PointF _
)
Dim instance As GraphicsPath
Dim pt1 As PointF
Dim pt2 As PointF

instance.AddLine(pt1, pt2)
public void AddLine (
    PointF pt1,
    PointF pt2
)
public:
void AddLine (
    PointF pt1, 
    PointF pt2
)
public void AddLine (
    PointF pt1, 
    PointF pt2
)
public function AddLine (
    pt1 : PointF, 
    pt2 : PointF
)

パラメータ

pt1

直線の開始点を表す PointF。

pt2

直線の終了点を表す PointF。

解説解説

このメソッドは、指定した点によって定義された線分を GraphicsPath の末尾に追加します。GraphicsPath に前回描画された直線や曲線がある場合は、そのパスの最後の点と新しい線分の最初の点を結ぶ線分が描画されます。

使用例使用例

例については、AddLine(Int32,Int32,Int32,Int32) のトピックを参照してください。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GraphicsPath クラス
GraphicsPath メンバ
System.Drawing.Drawing2D 名前空間

GraphicsPath.AddLine メソッド (Int32, Int32, Int32, Int32)

現在の図形に線分を追加します。

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

Public Sub AddLine ( _
    x1 As Integer, _
    y1 As Integer, _
    x2 As Integer, _
    y2 As Integer _
)
Dim instance As GraphicsPath
Dim x1 As Integer
Dim y1 As Integer
Dim x2 As Integer
Dim y2 As Integer

instance.AddLine(x1, y1, x2, y2)
public void AddLine (
    int x1,
    int y1,
    int x2,
    int y2
)
public:
void AddLine (
    int x1, 
    int y1, 
    int x2, 
    int y2
)
public void AddLine (
    int x1, 
    int y1, 
    int x2, 
    int y2
)
public function AddLine (
    x1 : int, 
    y1 : int, 
    x2 : int, 
    y2 : int
)

パラメータ

x1

直線の開始点の x 座標。

y1

直線の開始点の y 座標。

x2

直線の終了点の x 座標。

y2

直線の終了点の y 座標。

解説解説

このメソッドは、指定した点によって定義された線分を現在の図形の末尾に追加します。GraphicsPath に前回描画された直線や曲線がある場合は、そのパスの最後の点と新しい線分の最初の点を結ぶ線分が描画されます。

使用例使用例

次のコード例は、Windows フォームでの使用を意図してデザインされており、OnPaint イベント オブジェクトである PaintEventArgse が必要です。このコードはパスを作成し、三角形を構成する 3 つの直線を追加してから、画面にパスを描画します。

Public Sub AddLineExample(ByVal
 e As PaintEventArgs)

    ' Create a path and add a symetrical triangle using AddLine.
    Dim myPath As New GraphicsPath
    myPath.AddLine(30, 30, 60, 60)
    myPath.AddLine(60, 60, 0, 60)
    myPath.AddLine(0, 60, 30, 30)

    ' Draw the path to the screen.
    Dim myPen As New Pen(Color.Black,
 2)
    e.Graphics.DrawPath(myPen, myPath)
End Sub
private void AddLineExample(PaintEventArgs
 e)
{
             
    //Create a path and add a symetrical triangle using AddLine.
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddLine(30, 30, 60, 60);
    myPath.AddLine(60, 60, 0, 60);
    myPath.AddLine(0, 60, 30, 30);
             
    // Draw the path to the screen.
    Pen myPen = new Pen(Color.Black, 2);
    e.Graphics.DrawPath(myPen, myPath);
}
private:
   void AddLineExample( PaintEventArgs^ e )
   {
      //Create a path and add a symetrical triangle using AddLine.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddLine( 30, 30, 60, 60 );
      myPath->AddLine( 60, 60, 0, 60 );
      myPath->AddLine( 0, 60, 30, 30 );

      // Draw the path to the screen.
      Pen^ myPen = gcnew Pen( Color::Black,2.0f );
      e->Graphics->DrawPath( myPen, myPath );
   }
private void AddLineExample(PaintEventArgs
 e)
{
    //Create a path and add a symetrical triangle using AddLine.
    GraphicsPath myPath = new GraphicsPath();

    myPath.AddLine(30, 30, 60, 60);
    myPath.AddLine(60, 60, 0, 60);
    myPath.AddLine(0, 60, 30, 30);

    // Draw the path to the screen.
    Pen myPen = new Pen(Color.get_Black(), 2);

    e.get_Graphics().DrawPath(myPen, myPath);
} //AddLineExample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GraphicsPath クラス
GraphicsPath メンバ
System.Drawing.Drawing2D 名前空間



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「GraphicsPath.AddLine」の関連用語

GraphicsPath.AddLineのお隣キーワード
検索ランキング

   

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



GraphicsPath.AddLineのページの著作権

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

©2026 GRAS Group, Inc.RSS