I set the fill color of an object from a MapViewer script, but nothing happens

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:

  1. Copy the text below, from the Sub Main start line to the End Sub end line.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\MapViewer 8\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines.
  5. Press Ctrl+V to paste your copied script over top of these existing lines.
  6. Click Script | Run to run the script.




Sub Main

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

End Sub


Updated February 4, 2019

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


Please sign in to leave a comment.