This documentation is for the old version. Go to the latest Graphics Mill docs

GdiGraphics.DrawEllipse Method (Pen, Int32, Int32, Int32, Int32)

Draws an ellipse.

Namespace: Aurigma.GraphicsMill.Drawing
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
Public Sub DrawEllipse ( _
	pen As Pen, _
	x As Integer, _
	y As Integer, _
	width As Integer, _
	height As Integer _
)
C#
public void DrawEllipse(
	Pen pen,
	int x,
	int y,
	int width,
	int height
)

Parameters

pen

Type: Aurigma.GraphicsMill.Drawing.Pen

Pen object which is used to outline an ellipse.
x

Type: System.Int32

X-coordinate of the top left corner of the bounding rectangle for the ellipse.
y

Type: System.Int32

Y-coordinate of the top left corner of the bounding rectangle for the ellipse.
width

Type: System.Int32

Width of the bounding rectangle for the ellipse.
height

Type: System.Int32

Height of the bounding rectangle for the ellipse.

Remarks

Ellipse is defined by its tightest bounding rectangle. If you have an ellipse defined with central point and two radiuses, you can convert these parameters to rectangle in the following way:
C#

// Let's assume we have centerX, centerY - coordinates of the ellipse center, 
// horizontalRadius and verticalRadius - radiuses of the ellipse.
// We are calculating rectX, rectY, rectWidth, and rectHeight which specify 
// bounding rectangle for ellipse.

rectX = centerX - horizontalRadius;
rectY = centerY - verticalRadius;
rectWidth = horizontalRadius * 2;
rectHeight = verticalRadius * 2;

All the coordinates are measured in units specified with Unit property.

To fill an ellipse, use FillEllipse(Brush, Int32, Int32, Int32, Int32) method.

Examples

Visual Basic
Dim bitmap As New Aurigma.GraphicsMill.Bitmap( _
 Aurigma.GraphicsMill.RgbColor.White, 100, 60, _
 Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)

Dim graphics As System.Drawing.Graphics = bitmap.GetGdiplusGraphics()
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias

Dim brush As New System.Drawing.Drawing2D.HatchBrush( _
 System.Drawing.Drawing2D.HatchStyle.LargeConfetti, _
 System.Drawing.Color.Blue, System.Drawing.Color.Yellow)

graphics.FillEllipse(brush, 10, 5, 80, 50)

Dim pen As New System.Drawing.Pen(System.Drawing.Color.FromArgb(200, 255, 0, 0), 2)

graphics.DrawEllipse(pen, 10, 5, 80, 50)
C#
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(
    Aurigma.GraphicsMill.RgbColor.White, 100, 60, 
    Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);

System.Drawing.Graphics graphics = bitmap.GetGdiplusGraphics();
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

System.Drawing.Drawing2D.HatchBrush brush = 
    new System.Drawing.Drawing2D.HatchBrush(System.Drawing.Drawing2D.HatchStyle.LargeConfetti, 
    System.Drawing.Color.Blue, System.Drawing.Color.Yellow);

graphics.FillEllipse(brush, 10, 5, 80, 50);

System.Drawing.Pen pen = new System.Drawing.Pen(
    System.Drawing.Color.FromArgb(200, 255, 0, 0), 2);

graphics.DrawEllipse(pen, 10, 5, 80, 50);

See Also

Reference