GraphicsPath.AddLine 方法   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将行段追加到此 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)
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - 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 窗体一起使用,它需要 PaintEventArgseOnPaint 事件对象。 该代码将创建一个路径,添加构成三角形的三行,然后将路径绘制到屏幕。
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)
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - 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)
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - 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)
	参数
示例
有关示例,请参阅 AddLine(Int32, Int32, Int32, Int32)。
注解
此方法将指定点定义的线段添加到此 GraphicsPath的末尾。 如果 GraphicsPath中存在以前的线条或曲线,则绘制线条线段以将路径中的最后一个点连接到新线段中的第一个点。
适用于
AddLine(PointF, PointF)
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - GraphicsPath.cs
 
- Source:
 - 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)
	参数
示例
有关示例,请参阅 AddLine(Int32, Int32, Int32, Int32)。
注解
此方法将指定点定义的线段添加到此 GraphicsPath的末尾。 如果 GraphicsPath中存在以前的线条或曲线,则绘制线条线段以将路径中的最后一个点连接到新线段中的第一个点。