Circle Method

Draws a circle, ellipse, or arc on an  object.

Syntax

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

Remarks

The Circle method has these parts:

Part               Description

object            Object (non-MDI form, picture box, or Printer object) on which the circle is drawn.

Step              Specifies that the center of the circle, ellipse, or arc is relative to the current coordinates, given by the CurrentX and CurrentY properties of object.

(x,y)              Single-precision values indicating the coordinates for the center point of the circle, ellipse, or arc.  The scale properties (ScaleMode, ScaleLeft, ScaleTop, ScaleHeight, and ScaleWidth) of object determine the units of measure used.

radius            Single-precision value indicating the radius of the circle, ellipse, or arc.  The scale properties (ScaleMode, ScaleLeft, ScaleTop, ScaleHeight, and ScaleWidth) of object determine the unit of measure used.

color              Long integer value indicating the RGB color of the circle's outline.  If omitted, the value of the ForeColor property is used.  You can use the RGB function or QBColor function to specify the color.

start, end       Single-precision values.  When a partial circle or ellipse is  drawn, start and end specify (in radians) the beginning and end positions of the arc.  The range for both is -2 Pi radians to 2 Pi radians.  The default value for start is 0 radians; the default for end is 2 * Pi radians.

aspect           Single-precision value indicating the aspect ratio of the circle .  The default value is 1.0, which yields a perfect (non-elliptical) circle on any screen.

To fill a circle, set the FillColor and FillStyle properties of the object where the circle or ellipse is drawn.  Only a closed figure can be filled.  Closed figures include circles, ellipses, or pie slices (arcs with radius lines drawn at both ends).

When drawing a partial circle or ellipse, if start is negative, Circle draws a radius to start, and treats the angle as positive; if end is negative, Circle draws a radius to end and treats the angle as positive.  The Circle method always draws in a counter-clockwise (positive) direction.

The width of the line used to draw the circle, ellipse, or arc depends on the DrawWidth property.  The way the circle is drawn on the background depends on the setting of the DrawMode and DrawStyle properties.

When drawing pie slices, if you need to draw a radius to angle 0 (giving a horizontal line segment to the right), specify a very small negative value for start, rather than zero.

You can omit an argument in the middle of the syntax, but you must include the argument's comma before including the next argument.  If you omit a trailing argument, don't use any commas following the last argument you specify.

When Circle executes, CurrentX and CurrentY are set to the center point specified by the arguments.

BackColor, ForeColor Properties

CurrentX, CurrentY Properties

DrawMode Property

DrawStyle Property

DrawWidth Property

FillColor Property

FillStyle Property

QBColor Function

RGB Function

ScaleMode Property

ScaleHeight, ScaleWidth Properties

ScaleLeft, ScaleTop Properties

Shape Control

Circle Method Example

The Circle method draws a number of concentric circles in the center of a form.  To try this example, paste the code into the Declarations section of a form.  Then press F5 and click the form.

Sub Form_Click ()

Dim CX, CY, Radius                    ' Declare variable.

ScaleMode = 3                         ' Set scale to pixels.

CX = ScaleWidth / 2                   ' Set X position.

CY = ScaleHeight / 2                  ' Set Y position.

If CX > CY Then Limit = CY Else Limit = CX