GraphicsPath.AddLine メソッド

定義

この GraphicsPathに線分を追加します。

オーバーロード

AddLine(Int32, Int32, Int32, Int32)

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

AddLine(Single, Single, Single, Single)

この GraphicsPathに線分を追加します。

AddLine(Point, Point)

この GraphicsPathに線分を追加します。

AddLine(PointF, PointF)

この GraphicsPathに線分を追加します。

AddLine(Int32, Int32, Int32, Int32)

ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs

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

public:
 void AddLine(int x1, int y1, int x2, int y2);
public void AddLine (int x1, int y1, int x2, int y2);
member this.AddLine : int * int * int * int -> unit
Public Sub AddLine (x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer)

パラメーター

x1
Int32

線の始点の x 座標。

y1
Int32

線の始点の y 座標。

x2
Int32

線の終点の x 座標。

y2
Int32

線の終点の y 座標。

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

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 symmetrical 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);
}
Public Sub AddLineExample(ByVal e As PaintEventArgs)

    ' Create a path and add a symmetrical 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

注釈

このメソッドは、現在の図の末尾に、指定したポイントによって定義された線分を追加します。 GraphicsPathに前の線または曲線がある場合は、パスの最後の点を新しい線分の最初の点に接続する線分が描画されます。

適用対象

AddLine(Single, Single, Single, Single)

ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs

この GraphicsPathに線分を追加します。

public:
 void AddLine(float x1, float y1, float x2, float y2);
public void AddLine (float x1, float y1, float x2, float y2);
member this.AddLine : single * single * single * single -> unit
Public Sub AddLine (x1 As Single, y1 As Single, x2 As Single, y2 As Single)

パラメーター

x1
Single

線の始点の x 座標。

y1
Single

線の始点の y 座標。

x2
Single

線の終点の x 座標。

y2
Single

線の終点の y 座標。

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

注釈

このメソッドは、この GraphicsPathの末尾に、指定したポイントによって定義された線分を追加します。 GraphicsPathに前の線または曲線がある場合は、パスの最後の点を新しい線分の最初の点に接続する線分が描画されます。

適用対象

AddLine(Point, Point)

ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs

この GraphicsPathに線分を追加します。

public:
 void AddLine(System::Drawing::Point pt1, System::Drawing::Point pt2);
public void AddLine (System.Drawing.Point pt1, System.Drawing.Point pt2);
member this.AddLine : System.Drawing.Point * System.Drawing.Point -> unit
Public Sub AddLine (pt1 As Point, pt2 As Point)

パラメーター

pt1
Point

線の始点を表す Point

pt2
Point

線の終点を表す Point

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

注釈

このメソッドは、この GraphicsPathの末尾に、指定したポイントによって定義された線分を追加します。 GraphicsPathに前の線または曲線がある場合は、パスの最後の点を新しい線分の最初の点に接続する線分が描画されます。

適用対象

AddLine(PointF, PointF)

ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs

この GraphicsPathに線分を追加します。

public:
 void AddLine(System::Drawing::PointF pt1, System::Drawing::PointF pt2);
public void AddLine (System.Drawing.PointF pt1, System.Drawing.PointF pt2);
member this.AddLine : System.Drawing.PointF * System.Drawing.PointF -> unit
Public Sub AddLine (pt1 As PointF, pt2 As PointF)

パラメーター

pt1
PointF

線の始点を表す PointF

pt2
PointF

線の終点を表す PointF

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

注釈

このメソッドは、この GraphicsPathの末尾に、指定したポイントによって定義された線分を追加します。 GraphicsPathに前の線または曲線がある場合は、パスの最後の点を新しい線分の最初の点に接続する線分が描画されます。

適用対象