|KB no longer maintained - MapViewer is a Legacy Product. Legacy Products are still supported, but no longer receive new features or updates. Many of MapViewer's features have been moved to Surfer. Please contact firstname.lastname@example.org with any questions.|
In the MapViewer program, when the fill color is changed, the pattern is automatically changed. In a script, both the pattern and color must be set separately. So, in addition to setting the ForeColor property, it is also necessary to set the object's fill Pattern property. The example below creates a rectangle and sets the rectangle fill to a solid blue.
To run this script:
- Copy the text below, from the Sub Main start line to the End Sub end line.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\MapViewer 8\Scripter.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines.
- Press Ctrl+V to paste your copied script over top of these existing lines.
- Click Script | Run to run the script.
Dim mvApp, Plot As Object
Set mvApp = CreateObject("MapViewer.Application")
mvApp.Visible = True
'Creates a new plot window
Set Plot = mvApp.Documents.Add(mvDocPlot)
'Draws a rectangle
Set Rectangle = Plot.Layers.ActiveLayer.Shapes.AddRectangle(2,5,5,7)
'Fills the rectangle with blue solid fill
Rectangle.Fill.Pattern = "Solid"
Rectangle.Fill.ForeColor = mvColorBlue
Updated February 4, 2019