The ScaleBar object contains the properties for an individual scale bar. Scale bars are used to graphically represent distance and scale for a map.
Derived from: Shape object (All methods and properties of Shape apply to this object.)
Properties
Example
This example creates a ScaleBar object for a pie map.
Sub main
'Creates an instance of the MapViewer Application
'object and assigns it to the variable named "mvApp"
Set mvApp = CreateObject("MapViewer.Application")
'Makes the application main window visible
mvApp.Visible = True
'Assigns the location of the samples folder
'to the variable "InPath"
InPath$ = mvApp.ApplicationFolder + "samples\"
'Creates a map document object, and assigns
'it to the variable named "Plot"
Set Plot = mvApp.Documents.Add(DocType:=mvDocPlot)
'Declares PlotLayers as an object
Dim PlotLayers As Object
'Assigns the map document layers to the
'variable named "PlotLayers"
Set PlotLayers = Plot.Layers
'Declares CurrentLayer as an object
Dim CurrentLayer As Object
'Assigns the active plot layer to the
'variable named "CurrentLayer"
Set CurrentLayer = PlotLayers.ActiveLayer
'Defines the variables for a pie map
Dim Variables(1 To 3) As Long
Variables(1) = 4
Variables(2) = 8
Variables(3) = 6
'Creates a pie map object and assigns it to
'the variable named "PieMap"
Set PieMap = Plot.CreatePieMap( Variables, BoundaryFileName:=InPath$+ _
"co2010.gsb", DataFileName:=InPath$+"co2010.dat", _
BoundaryFileOptions:="SecondaryIDField=2, Attribute1Field=1", _
PIDCol:=1)
'Create a ScaleBar object on the active layer and
'assign it to the variable named "ScaleBar"
Set ScaleBar = CurrentLayer.AddScaleBar(5,3)
End Sub