How can I change the background color in Surfer via automation?

This article contains a sample script for setting the background color in Surfer via automation.

To run this script:

  1. Copy the script below, or download the attached BAS file: background.bas.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 16\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
  6. Click Script | Run to run the script.


'This script demonstrates the following:
'	Grid a sample data file
'	Create a contour map
'	Create checkered background color
'												SKP 9/99 Surfer 7

Sub Main
	Dim SurferApp As Object
	Set SurferApp = CreateObject("Surfer.Application")
	SurferApp.Visible = True
	Dim Doc As Object
	Set Doc = SurferApp.Documents.Add

	SurferApp.GridData (DataFile:=path+"demogrid.dat", _
		ShowReport:=False, Algorithm:=srfKriging, OutGrid:=path+"sample.grd")

	Dim MapFrame As Object
	Set MapFrame = Doc.Shapes.AddContourMap(GridFileName:=Path+"Colorado.grd")
	'Changes the map background
	MapFrame.BackgroundFill.Pattern = "Diagonal Cross"
	MapFrame.BackgroundFill.BackColorRGBA.Color = srfColorRed
	MapFrame.BackgroundFill.ForeColorRGBA.Color = srfColorIceBlue
End Sub


Updated November 08, 2018

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.