Redigera

Dela via


GraphicsPath.AddEllipse Method

Definition

Adds an ellipse to the current path.

Overloads

AddEllipse(Rectangle)

Adds an ellipse to the current path.

AddEllipse(RectangleF)

Adds an ellipse to the current path.

AddEllipse(Int32, Int32, Int32, Int32)

Adds an ellipse to the current path.

AddEllipse(Single, Single, Single, Single)

Adds an ellipse to the current path.

AddEllipse(Rectangle)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds an ellipse to the current path.

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)

Parameters

rect
Rectangle

A Rectangle that represents the bounding rectangle that defines the ellipse.

Examples

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, an OnPaint event object. The code performs the following actions:

Creates a bounding rectangle that defines an ellipse.

Creates a path and adds the ellipse to the path.

Draws the path to screen.

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

Applies to

AddEllipse(RectangleF)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds an ellipse to the current path.

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)

Parameters

rect
RectangleF

A RectangleF that represents the bounding rectangle that defines the ellipse.

Examples

For an example, see AddEllipse(Rectangle).

Applies to

AddEllipse(Int32, Int32, Int32, Int32)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds an ellipse to the current path.

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)

Parameters

x
Int32

The x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.

y
Int32

The y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.

width
Int32

The width of the bounding rectangle that defines the ellipse.

height
Int32

The height of the bounding rectangle that defines the ellipse.

Examples

For an example, see AddEllipse(Rectangle).

Applies to

AddEllipse(Single, Single, Single, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds an ellipse to the current path.

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)

Parameters

x
Single

The x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.

y
Single

The y-coordinate of the upper left corner of the bounding rectangle that defines the ellipse.

width
Single

The width of the bounding rectangle that defines the ellipse.

height
Single

The height of the bounding rectangle that defines the ellipse.

Examples

For an example, see AddEllipse(Rectangle).

Applies to