Circle Method

Applies To

Report Object.

Description

The Circle method draws a circle, an ellipse, or an arc on a Report object when the Print event occurs.

Syntax

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

You can use this method only in an event procedure or a macro specified by the event properties OnPrint or OnFormat for a report section, or OnPage for a report.

The Circle method uses the following arguments.

Argument Description
object Report object on which the circle is drawn.
Step A key word that specifies that the center of the circle, ellipse, or arc is relative to the current coordinates given by the current settings for the CurrentX and CurrentY properties of object.
x, y Single values indicating the coordinates of the center point of the circle, ellipse, or arc. The scale properties (ScaleMode, ScaleLeft, ScaleTop, ScaleHeight, and ScaleWidth) of object determine the unit of measure used.
radius A Single 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. By default distances are measured in twips.


Argument Description
color A Long value indicating the RGB (red-green-blue) color of the circle outline. If this argument is omitted, the value of the ForeColor property is used. You can also use the RGB function or QBColor function to specify the color.
start, end Single values. When a partial circle or ellipse is drawn, start and end specify (in radians) the beginning and end positions of the arc. The default value for start is 0 radians; the default for end is 2 pi radians. The range for both is -2 pi radians to 2 pi radians.
aspect Single value indicating the aspect ratio of the circle. The default value is 1.0, which yields a perfect (nonelliptical) circle on any screen.


Remarks

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

To fill a circle, set the FillColor and FillStyle properties of the report. Only a closed figure can be filled. Closed figures include circles, ellipses, and pie slices, which are arcs with radius lines drawn at both ends.

When drawing pie slices, if you need to draw a radius to angle 0 to form a horizontal line segment to the right, specify a very small negative value for start rather than 0. For example, you might specify -.00000001 for start.

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.

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

When you apply the Circle method, the CurrentX and CurrentY properties are set to the center point specified by the arguments x and y.

See Also

CurrentX, CurrentY Properties; DrawMode Property; DrawStyle Property; DrawWidth Property; Event Properties; FillColor Property; FillStyle Property; ForeColor Property; QBColor Function; RGB Function; ScaleHeight, ScaleWidth Properties; ScaleLeft, ScaleTop Properties; ScaleMode Property.

Example

The following example uses the Circle method to draw a circle, and then create a pie slice within the circle and color it red.

To try this example in Microsoft Access, create a new report by clicking the New button on the Reports tab of the Database window. Set the OnPrint property of the Detail section to [Event Procedure]. Enter the following code in the report’s module, then switch to Print Preview.


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    Const conPI = 3.14159265359

    Dim sngHCtr As Single, sngVCtr As Single, sngRadius As Single
    Dim sngStart As Single, sngEnd As Single

    sngHCtr = Me.ScaleWidth / 2                ' Horizontal center.
    sngVCtr = Me.ScaleHeight / 2                ' Vertical center.
    sngRadius = Me.ScaleHeight / 3            ' Circle radius.
    Me.Circle(sngHCtr, sngVCtr), sngRadius    ' Draw circle.
    sngStart = -0.00000001                    ' Start of pie slice.
    sngEnd = -2 * conPI / 3                    ' End of pie slice.
    Me.FillColor = RGB(255,0,0)                ' Color pie slice red.
    Me.FillStyle = 0    ' Fill pie slice.
    ' Draw Pie slice within circle
    Me.Circle(sngHCtr, sngVCtr), sngRadius, , sngStart, sngEndSub