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

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

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 に線分を追加します。

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 に線分を追加します。

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 に線分を追加します。

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最後の点を新しい線分の最初の点に接続する線分セグメントが描画されます。

適用対象