JavaScript Editor js editor     Web development 

Main Page

Specifies an array of coordinates for creating polygon shapes using the Shape control and polygon lines using the Line control. Read/write at design time and run time.

For Shape controls, PolyPoints creates a polygon shape. For Line controls, PolyPoints creates a polygon line or shape.

Control.PolyPoints [= cArrayName]

Return Value


Specifies the name of an array containing pairs of coordinates for drawing a polygon shape or line. Coordinates use the format (X, Y). The array must be in scope in order for the object to properly display the polygon or polyline
The array can have any dimension; however, having two columns makes it easier for you to program. Store the X-coordinate point in first column and store the Y-coordinate point in the second column. The array must be filled entirely with numeric values; otherwise, trailing elements containing False (.F.) will prevent the line or shape from being drawn.

PolyPoints requires at least two pairs of coordinates to draw a line, three pairs of coordinates to draw a polygon line, three pairs of coordinates to draw a polygon shape with the Shape control, and four pairs of coordinates to draw an enclosed polygon line, or shape, with the Line control.

To create a polygon shape with the Line control, the fifth pair of coordinates in the array must have the same coordinates as the first pair to draw the last line segment and complete the polygon shape. When setting the LineSlant property to draw Bezier curves, you must specify a total of (3n + 1) coordinates with n representing the number of curves you want to draw. For more information, see LineSlant Property.


Applies To: Line | Shape

Visual FoxPro draws polygons in the order that the coordinates appear in the array, which affects the fill regions associated with polygons. You can draw shapes within the polygon without touching the polygon border by specifying points within the border. For more information about fill regions and styles, see FillStyle Property and FillColor Property.

The coordinates specified in the array are relative percentages to the dimensions of the Shape (or Line) control so that the polygon will resize as the shape is resized.

Updating the array updates the Shape or Line control automatically the next time it is drawn.

If the array contains an odd number of elements, the last element is disregarded.

If PolyPoints is set, Visual FoxPro disregards the Style property when it is set to 3 (Themed), the Curvature property, and the three-dimensional SpecialEffect property settings.

Visual FoxPro redraws the shape automatically when the Rotation setting, which rotates the shape, is changed. For more information, see Rotation Property.

The array must be in scope for the object to display the polygon or polyline. If you want to display the polygon in design-time, then the PolyPoints property must point to a public array in scope. For more information about scope, see Access to Variables.


The following example displays a form with a polygon line drawn using the Line control based on an array of coordinates specified by the PolyPoints property.

В Copy Code
DIMENSION poly[5,2]
poly[1,1]= 0
poly[1,2]= 50
poly[2,1]= 50
poly[2,2]= 100
poly[3,1]= 100
poly[3,2]= 50
poly[4,1]= 50
poly[4,2]= 0
frmMyForm = CREATEOBJECT('Form')  
frmMyForm.shpLine.Top = 20  
frmMyForm.shpLine.Left = 125 
frmMyForm.shpLine.PolyPoints = "poly"
frmMyForm.shpLine.Visible = .T.  
frmMyForm.cmdCmndBtn1.Visible =.T.  
DEFINE CLASS cmdMyCmndBtn1 AS CommandButton  
   Caption = '\<Quit'  
   Cancel = .T.  
   Left = 125  
   Top = 150  
   Height = 25  

See Also

JavaScript Editor js editor     Web development