Drawing Ellipses

See Also

The aspect ratio of a circle controls whether or not it appears perfectly round (a circle) or elongated (an ellipse). The complete syntax for the Circle method is:

[object.]Circle [Step](x, y), radius, [color], [start], [end] [, aspect]

The start and end arguments are optional, but the commas are necessary if you want to skip arguments. For example, if you include the radius and aspect arguments, but no color, start, or end argument, you must add four successive commas to indicate that you’re skipping the three arguments:

Circle (1000, 1000), 500, , , , 2

The aspect argument specifies the ratio of the vertical to horizontal dimensions. Here, aspect is a positive floating-point number. This means you can specify integer or fractional expressions, but not negative values. Large values for aspect produce ellipses stretched out along the vertical axis, while small values for aspect produce ellipses stretched out along the horizontal axis. Since an ellipse has two radii — one horizontal x-radius and one vertical y-radius — Visual Basic applies the single argument radius in a Circle statement to the longer axis. If aspect is less than one, radius is the x-radius; if aspect is greater than or equal to one, radius is the y-radius.

Note   The aspect argument always specifies the ratio between the vertical and horizontal dimensions in terms of true physical distance. To ensure that this happens (even when you use a custom scale), the radius is specified in terms of horizontal units.

The following procedure illustrates how different aspect values determine whether Circle uses the radius argument as the x-radius or the y-radius of an ellipse:

Private Sub Form_Click ()
' Draw solid ellipse.
   FillStyle = 0
   Circle (600, 1000), 800, , , , 3
' Draw empty ellipse.
   FillStyle = 1
   Circle (1800, 1000), 800, , , , 1 / 3
End Sub

The output is shown in Figure 12.17.

Figure 12.17   Ellipses drawn with the Circle method

For More Information   For more information about drawing circles and arcs, see "Drawing Circles" earlier in this chapter.