# Ellipse Function

`Declare Function Ellipse Lib "gdi32.dll" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long`

Ellipse draws an ellipse on a graphics-supporting object. The two coordinate pairs passed to the function are not part of the ellipse itself, but define its bounding rectangle. The bounding rectangle is the smallest possible rectangle containing the ellipse. The ellipse will be drawn with the color of the object's .ForeColor property. A return value of 0 indicates an error, while a non-zero return value indicates success.

hdc
  The device context of the object.
X1
  The x coordinate of the bounding rectangle's upper-left corner.
Y1
  The y coordinate of the bounding rectangle's upper-left corner.
X2
  The x coordinate of the bounding rectangle's lower-right corner.
Y2
  The y coordinate of the bounding rectangle's lower-right corner.

Example:

    ' Draw a red ellipse with bounding rectangle (25, 25)-(100, 75)
    Picture1.ForeColor = RGB(255, 0, 0)  ' red
    x = Ellipse(Picture1.hdc, 25, 25, 100, 75)

Category: Graphics
Back to the index.