GraphicsPath.AddEllipse 方法

定义

向当前路径添加一个椭圆。

重载

AddEllipse(Rectangle)

向当前路径添加一个椭圆。

AddEllipse(RectangleF)

向当前路径添加一个椭圆。

AddEllipse(Int32, Int32, Int32, Int32)

向当前路径添加一个椭圆。

AddEllipse(Single, Single, Single, Single)

向当前路径添加一个椭圆。

AddEllipse(Rectangle)

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

向当前路径添加一个椭圆。

public:
 void AddEllipse(System::Drawing::Rectangle rect);
public void AddEllipse (System.Drawing.Rectangle rect);
member this.AddEllipse : System.Drawing.Rectangle -> unit
Public Sub AddEllipse (rect As Rectangle)

参数

rect
Rectangle

一个 Rectangle,表示定义椭圆的边框。

示例

下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse事件OnPaint对象。 此代码执行以下操作:

创建定义椭圆的边框。

创建路径并将椭圆添加到路径。

绘制屏幕的路径。

private:
   void AddEllipseExample( PaintEventArgs^ e )
   {
      // Create a path and add an ellipse.
      Rectangle myEllipse = Rectangle(20,20,100,50);
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddEllipse( myEllipse );

      // Draw the path to the screen.
      Pen^ myPen = gcnew Pen( Color::Black,2.0f );
      e->Graphics->DrawPath( myPen, myPath );
   }
private void AddEllipseExample(PaintEventArgs e)
{
             
    // Create a path and add an ellipse.
    Rectangle myEllipse = new Rectangle(20, 20, 100, 50);
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddEllipse(myEllipse);
             
    // Draw the path to the screen.
    Pen myPen = new Pen(Color.Black, 2);
    e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddEllipseExample(ByVal e As PaintEventArgs)

    ' Create a path and add an ellipse.
    Dim myEllipse As New Rectangle(20, 20, 100, 50)
    Dim myPath As New GraphicsPath
    myPath.AddEllipse(myEllipse)

    ' Draw the path to the screen.
    Dim myPen As New Pen(Color.Black, 2)
    e.Graphics.DrawPath(myPen, myPath)
End Sub

适用于

AddEllipse(RectangleF)

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

向当前路径添加一个椭圆。

public:
 void AddEllipse(System::Drawing::RectangleF rect);
public void AddEllipse (System.Drawing.RectangleF rect);
member this.AddEllipse : System.Drawing.RectangleF -> unit
Public Sub AddEllipse (rect As RectangleF)

参数

rect
RectangleF

一个 RectangleF,表示定义椭圆的边框。

示例

有关示例,请参见 AddEllipse(Rectangle)

适用于

AddEllipse(Int32, Int32, Int32, Int32)

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

向当前路径添加一个椭圆。

public:
 void AddEllipse(int x, int y, int width, int height);
public void AddEllipse (int x, int y, int width, int height);
member this.AddEllipse : int * int * int * int -> unit
Public Sub AddEllipse (x As Integer, y As Integer, width As Integer, height As Integer)

参数

x
Int32

定义椭圆的边框的左上角的 X 坐标。

y
Int32

定义椭圆的边框的左上角的 Y 坐标。

width
Int32

定义椭圆的边框的宽度。

height
Int32

定义椭圆的边框的高度。

示例

有关示例,请参见 AddEllipse(Rectangle)

适用于

AddEllipse(Single, Single, Single, Single)

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

向当前路径添加一个椭圆。

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

参数

x
Single

定义椭圆的边框的左上角的 X 坐标。

y
Single

定义椭圆的边框的左上角的 Y 坐标。

width
Single

定义椭圆的边框的宽度。

height
Single

定义椭圆的边框的高度。

示例

有关示例,请参见 AddEllipse(Rectangle)

适用于