GraphicsPath.AddArc 方法

定义

向当前图形追加一段椭圆弧。

重载

AddArc(Single, Single, Single, Single, Single, Single)

向当前图形追加一段椭圆弧。

AddArc(Int32, Int32, Int32, Int32, Single, Single)

向当前图形追加一段椭圆弧。

AddArc(Rectangle, Single, Single)

向当前图形追加一段椭圆弧。

AddArc(RectangleF, Single, Single)

向当前图形追加一段椭圆弧。

AddArc(Single, Single, Single, Single, Single, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

向当前图形追加一段椭圆弧。

public:
 void AddArc(float x, float y, float width, float height, float startAngle, float sweepAngle);
public void AddArc (float x, float y, float width, float height, float startAngle, float sweepAngle);
member this.AddArc : single * single * single * single * single * single -> unit
Public Sub AddArc (x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single)

参数

x
Single

矩形区域左上角的 X 坐标,该区域定义将要从中绘制弧线的椭圆。

y
Single

矩形区域左上角的 Y 坐标,该区域定义将要从中绘制弧线的椭圆。

width
Single

矩形区域的宽度,该区域定义将要从中绘制弧线的椭圆。

height
Single

矩形区域的高度,该区域定义将要从中绘制弧线的椭圆。

startAngle
Single

弧线的起始角度,以度为单位从 X 轴顺时针测量。

sweepAngle
Single

startAngle 和弧线末尾之间的角度。

示例

有关示例,请参见 AddArc(Rectangle, Single, Single)

注解

如果图中有前一条线或曲线,则添加一条线将上一段的端点连接到弧线的开头。

弧线沿指定矩形边界的椭圆的外围进行跟踪。 弧的起点是通过从椭圆 (的 x 轴顺时针测量 0 度角) 开始角度的度数来确定的。 通过按扫描角度中的度数从起点顺时针测量来定位终结点。 如果扫描角度大于 360 度或小于 -360 度,则弧线将分别扫描 360 度或 -360 度。

适用于

AddArc(Int32, Int32, Int32, Int32, Single, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

向当前图形追加一段椭圆弧。

public:
 void AddArc(int x, int y, int width, int height, float startAngle, float sweepAngle);
public void AddArc (int x, int y, int width, int height, float startAngle, float sweepAngle);
member this.AddArc : int * int * int * int * single * single -> unit
Public Sub AddArc (x As Integer, y As Integer, width As Integer, height As Integer, startAngle As Single, sweepAngle As Single)

参数

x
Int32

矩形区域左上角的 X 坐标,该区域定义将要从中绘制弧线的椭圆。

y
Int32

矩形区域左上角的 Y 坐标,该区域定义将要从中绘制弧线的椭圆。

width
Int32

矩形区域的宽度,该区域定义将要从中绘制弧线的椭圆。

height
Int32

矩形区域的高度,该区域定义将要从中绘制弧线的椭圆。

startAngle
Single

弧线的起始角度,以度为单位从 X 轴顺时针测量。

sweepAngle
Single

startAngle 和弧线末尾之间的角度。

示例

有关示例,请参见 AddArc(Rectangle, Single, Single)

注解

如果图中有前一条线或曲线,则添加一条线将上一段的端点连接到弧线的开头。

弧线沿指定矩形边界的椭圆的外围进行跟踪。 弧的起点是通过从椭圆 (的 x 轴顺时针测量 0 度角) 开始角度的度数来确定的。 通过按扫描角度中的度数从起点顺时针测量来定位终结点。 如果扫描角度大于 360 度或小于 -360 度,则弧线将分别扫描 360 度或 -360 度。

适用于

AddArc(Rectangle, Single, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

向当前图形追加一段椭圆弧。

public:
 void AddArc(System::Drawing::Rectangle rect, float startAngle, float sweepAngle);
public void AddArc (System.Drawing.Rectangle rect, float startAngle, float sweepAngle);
member this.AddArc : System.Drawing.Rectangle * single * single -> unit
Public Sub AddArc (rect As Rectangle, startAngle As Single, sweepAngle As Single)

参数

rect
Rectangle

一个 Rectangle,表示从中截取弧线的椭圆的矩形边界。

startAngle
Single

弧线的起始角度,以度为单位从 X 轴顺时针测量。

sweepAngle
Single

startAngle 和弧线末尾之间的角度。

示例

下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse事件OnPaint对象。 此代码执行以下操作:

  • 创建一个矩形,从中定义弧线。

  • 创建路径 myPath

  • 定义从 0 度到 180 度的 180 度椭圆弧,并将其追加到路径。

  • 绘制到屏幕的路径。

private:
   void AddArcExample( PaintEventArgs^ e )
   {
      // Create a GraphicsPath object.
      GraphicsPath^ myPath = gcnew GraphicsPath;

      // Set up and call AddArc, and close the figure.
      Rectangle rect = Rectangle(20,20,50,100);
      myPath->StartFigure();
      myPath->AddArc( rect, 0, 180 );
      myPath->CloseFigure();

      // Draw the path to screen.
      e->Graphics->DrawPath( gcnew Pen( Color::Red,3.0f ), myPath );
   }
private void AddArcExample(PaintEventArgs e)
{
             
    // Create a GraphicsPath object.
    GraphicsPath myPath = new GraphicsPath();
             
    // Set up and call AddArc, and close the figure.
    Rectangle rect = new Rectangle(20, 20, 50, 100);
    myPath.StartFigure();
    myPath.AddArc(rect, 0, 180);
    myPath.CloseFigure();
             
    // Draw the path to screen.
    e.Graphics.DrawPath(new Pen(Color.Red, 3), myPath);
}
Public Sub AddArcExample(ByVal e As PaintEventArgs)

    ' Create a GraphicsPath object.
    Dim myPath As New GraphicsPath

    ' Set up and call AddArc, and close the figure.
    Dim rect As New Rectangle(20, 20, 50, 100)
    myPath.StartFigure()
    myPath.AddArc(rect, 0, 180)
    myPath.CloseFigure()

    ' Draw the path to screen.
    e.Graphics.DrawPath(New Pen(Color.Red, 3), myPath)
End Sub

注解

如果图中有前一条线或曲线,则添加一条线将上一段的端点连接到弧线的开头。

弧线沿指定矩形边界的椭圆的外围进行跟踪。 弧的起点是通过从椭圆 (的 x 轴顺时针测量 0 度角) 开始角度的度数来确定的。 通过按扫描角度中的度数从起点顺时针测量来定位终结点。 如果扫描角度大于 360 度或小于 -360 度,则弧线将分别扫描 360 度或 -360 度。

适用于

AddArc(RectangleF, Single, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

向当前图形追加一段椭圆弧。

public:
 void AddArc(System::Drawing::RectangleF rect, float startAngle, float sweepAngle);
public void AddArc (System.Drawing.RectangleF rect, float startAngle, float sweepAngle);
member this.AddArc : System.Drawing.RectangleF * single * single -> unit
Public Sub AddArc (rect As RectangleF, startAngle As Single, sweepAngle As Single)

参数

rect
RectangleF

一个 RectangleF,表示从中截取弧线的椭圆的矩形边界。

startAngle
Single

弧线的起始角度,以度为单位从 X 轴顺时针测量。

sweepAngle
Single

startAngle 和弧线末尾之间的角度。

示例

有关示例,请参见 AddArc(Rectangle, Single, Single)

注解

如果图中有前一条线或曲线,则添加一条线将上一段的端点连接到弧线的开头。

弧线沿指定矩形边界的椭圆的外围进行跟踪。 弧的起点是通过从椭圆 (的 x 轴顺时针测量 0 度角) 开始角度的度数来确定的。 通过按扫描角度中的度数从起点顺时针测量来定位终结点。 如果扫描角度大于 360 度或小于 -360 度,则弧线将分别扫描 360 度或 -360 度。

适用于