The other major command is Circle, which allows you to draw a circle, ellipse or an arc. The circle statement uses the following syntax:
Printer.Circle [Step] (x, y), radius, [color, start, end, aspect]
As you can see, there are once again plenty of options. The (x, y)
part specifies the centre of the circle to be drawn. As in the Line function,
using the Step
option means that these x and y coordinates will
be taken relative to CurrentX and CurrentY. The radius
parameter
specifies the radius of the circle (that is the distance from its centre to
its edge). There are then a number of optional parameters. color
specifies
the colour of the circle in RGB (red green blue). The start
and
end
parameters allow you to draw a partial circle, or rather an
ellipse or arc. start specifies the start of the arc, in radians (see note),
and end specifies the end of the arc, in radians. Finally, the aspect
option allows you to change the aspect ratio of the circle. A value of 1 is
a perfect circle, a value of 1.5 is an ellipse.
Note
Radians are a used to measure angles. 1 radian is (180/pi)°. 360°= 2 * pi |
Now lets take a look at a few examples.
Printer.Circle (3000, 3000), 1000, RBG(100, 30, 30)
Draws a circle like this:
To fill a circle you will need to change the FillStyle option, which is discussed in the next section.
Using the end and start properties, we can create arcs.
Note
|
This code
Printer.Circle (3000, 3000), 1000, vbBlue, 0, pi
draws the following arc:
If you provide negative values, VB draws a line to the center of the circle too. For example,
Printer.Circle (3000, 3000), 1000, vbBlue, -1, -pi
draws the following:
Finally, using the aspect option, we can draw an ellipse. For example,
Printer.Circle (3000, 3000), 1000, vbBlue, , , 0.5
outputs
Comments