Share via


Circle Method

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

expression.Circle(Step(x, y), radius, color, start, end, aspect)

Remarks

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

When drawing a partial circle or ellipse, if the start argument is negative, the Circle method draws a radius to the position specified by the start argument and treats the angle as positive. If the end argument is negative, the Circle method draws a radius to the position specified by the end argument 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 the start argument rather than 0. For example, you might specify –.00000001 for the start argument.

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 x and y arguments.

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. 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
    Dim 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.
' Draw circle.
Me.<strong class="bterm">Circle(</strong>sngHCtr, sngVCtr<strong class="bterm">)</strong>, sngRadius
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.<strong class="bterm">Circle(</strong>sngHCtr, sngVCtr<strong class="bterm">)</strong>, sngRadius, , sngStart, sngEnd

End Sub

See Also