SymbologyLegend Script
This script demonstrates all the properties in the SymbologyLegend object.
Dim Surfer As Object
Set Surfer = GetObject(,"Surfer.Application")
Surfer.Visible = True
'Create a doc that has a few maps and layer types
Set doc = Surfer.Documents.Add
Set map1 = doc.Shapes.AddBaseMap(Surfer.Path+"\samples\demorect.bln")
Set baseLayer = doc.Shapes.AddDataBaseLayer(map1, Surfer.Path+"\samples\demogrid.dat")
baseLayer.ApplySymbologyUniqueValues(AttributeField:="Elevation")
baseLayer.Name = "Symbology Layer"
Set postLayer = doc.Shapes.AddPostLayer(map1, Surfer.Path+"\samples\demogrid.dat")
postLayer.Name = "Post Layer"
Set map2 = doc.Shapes.AddClassedPostMap(Surfer.Path+"\samples\demogrid.dat")
map2.Overlays(1).Name = "Classed Post Layer"
map2.Left = map1.Left + map1.Width 'space it apart
Set vecLayer = doc.Shapes.AddVectorLayer(map2, Surfer.Path+"\samples\demogrid.grd")
vecLayer.Name = "Vector Grid Layer"
'Add a legend to show all layers in the current doc
Set Legend = doc.AddLegend
'Print the name of all the layers in this legend
For i=1 To Legend.LegendLayers.Count
Debug.Print Legend.LegendLayers.Item(i).LayerName
Next
'Change the font and format for all layer legends (TopLegend properties)
Legend.SampleFont.Color = srfColorBlue
Legend.SampleFormat.Type = srfLabFixed
Legend.SampleFormat.NumDigits = 1
'Change some individual properties of symbology layers (SymbologyLegend properties)
Set symLeg = Legend.LegendLayers.Item("Symbology Layer")
symLeg.Template = "fill: \fill symbol: \symbol"
symLeg.SampleFillSize = .3
symLeg.SampleSpacing = .1