Polygon Object
The Polygon object contains the properties of a polygon. Polygons are created with the AddPolygon, AddRectangle, and AddEllipse methods of the Shapes collection.
Derived from: Shape object (All methods and properties of Shape apply to this object.)
The following table provides the properties of the Polygon object.
Property |
Description |
Returns the fill format object. It is a read-only property. |
|
Returns the line format object. It is a read-only property. |
|
Returns the number of vertices per sub-polygon. It is a read-only property. |
|
Returns the polygon vertices. It is a read-only property. |
The following table provides the methods of the Polygon object.
Method |
Description |
Sets the polygon vertices. |
Example
The following script demonstrates how the Polygon object is used in reference to the Shapes collection.
Sub Main
'Declares SurferApp as an object
Dim SurferApp As Object
'Creates an instance of the Surfer Application object and assigns it to
'the variable named "SurferApp"
Set SurferApp = CreateObject("Surfer.Application")
'Makes Surfer visible
SurferApp.Visible = True
'Declares Plot as an object
Dim Plot As Object
'Creates a plot document in Surfer and assigns it to the variable named
'"Plot"
Set Plot = SurferApp.Documents.Add(srfDocPlot)
'Declares Shapes as an object
Dim Shapes As Object
'Assigns the Shapes collection to the variable named "Shapes"
Set Shapes = Plot.Shapes
'Declares Polygon as an object
Dim Polygon As Object
'Declares PolygonArray as a double array
Dim PolygonArray(5) As Double
PolygonArray(0) = 4: PolygonArray(1) = 1
PolygonArray(2) = 7: PolygonArray(3) = 3
PolygonArray(4) = 2: PolygonArray(5) = 6
'Creates a polygon and assigns it to the variable named "Polygon"
Set Polygon = Shapes.AddPolygon(PolygonArray)
End Sub