# Polygon- Draws a polygon

Draws a series of lines by joining the points passed as parameters and closing the figure with a line that goes from the last point to the first.

- Polygon(X1,Y1,X2,Y2, ... Xn,Yn[,R])

Parameters:

- (int) X1: horizontal coordinate of the first point;

- (int) Y1: Vertical coordinate of the first point;

- (int) X2: horizontal coordinate of the second point;

- (int) Y2: Vertical coordinate of the second point;

- (int) Xn: horizontal coordinate of the point N;

- (int) Yn: Vertical coordinate of the point N;

- (int) R: rotation expressed in degrees (optional).

Description:

Use Polygon to draw a polygon. The polygon is defined by all its X and Y points joined with lines. The polygon is closed with a line from the last point to the first. A polygon must have at least 2 points and a maximum of 100 points. If the polygon has 2 points, only one line is drawn.

The polygon lines are drawn using the current pen and color (Pen, ColorPen), while the surface is filled with the current brush or color (Brush, ColorBrush).

The optional parameter R defines the rotation of the polygon around its hypothetical center or around a origin point defined with the GraphicOrigin instruction. The value is expressed in degrees. If omitted the rotation is 0 degrees.

Drawing with the mouse:

From the drawing context menu choose Polygon. Move the pointer to the first point on the polygon and press the left button to fix it. Move the pointer over the other points of the polygon - the polygon made up of all its points is drawn with the mouse pointer last point - and press the left button. To end the polygon, fix the last point by holding down the Ctrl key.

Once the coordinates of the polygon have been defined, the mouse wheel is used to rotate it around its hypothetical center or around a point of origin defined with the GraphicOrigin instruction. When using the mouse wheel with the Ctrl key, the polygon is enlarged or reduced. To insert the Polygon instruction into the graph, confirm with the left mouse button.