ScaleBars Collection

The ScaleBars collection contains of all the ScaleBar objects for a given MapFrame.

The following table provides the properties of the ScaleBars collection:

Property

Description

Application

Returns the application object. It is a read-only property

Count

Returns the number of scale bars. It is a read-only property.

Parent

Returns the parent object. It is a read-only property.

The following table provides the methods of the ScaleBars collection:

Method

Description

Add

Adds a new scale bar to the collection.

Item*

Returns an individual scale bar.

*default method

Example

The following script demonstrates how the ScaleBars collection is used in reference to the MapFrame object.

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 MapFrame as an object

Dim MapFrame As Object

 

'Creates a contour map and assigns the map coordinate system to the

'variable named "MapFrame"

Set MapFrame = Shapes.AddContourMap(GridFileName:=SurferApp.Path+"\Samples\demogrid.grd")

 

'Declares ScaleBars as an object

Dim ScaleBars As Object

 

'Assigns the ScaleBars collection to the variable named "ScaleBars"

Set ScaleBars = MapFrame.ScaleBars

 

End Sub