GraphicsPath.AddEllipse 方法

定義

將橢圓形加入目前的路徑。

多載

AddEllipse(Rectangle)

將橢圓形加入目前的路徑。

AddEllipse(RectangleF)

將橢圓形加入目前的路徑。

AddEllipse(Int32, Int32, Int32, Int32)

將橢圓形加入目前的路徑。

AddEllipse(Single, Single, Single, Single)

將橢圓形加入目前的路徑。

AddEllipse(Rectangle)

將橢圓形加入目前的路徑。

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,表示定義橢圓形的週框 (Bounding Rectangle)。

範例

下列程式碼範例是設計來搭配Windows Forms使用,而且需要 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)

將橢圓形加入目前的路徑。

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,表示定義橢圓形的週框 (Bounding Rectangle)。

範例

如需範例,請參閱 AddEllipse(Rectangle)

適用於

AddEllipse(Int32, Int32, Int32, Int32)

將橢圓形加入目前的路徑。

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)

將橢圓形加入目前的路徑。

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)

適用於