AddShape method

Adds a new radius circle, oval, or rectangle to the map. Returns the newly created Shape object with a Type property of geoAutoShape.

Applies to

Collections:  Shapes

Syntax

object.AddShape(Type, Center, Width, Height)

Parameters

Part Description
object Required. An expression that returns a Shapes collection.
Type Required GeoAutoShapeType. Type of shape to create.
GeoAutoShapeType Value Description
geoShapeRadius
1009
Circle based on the radius
geoShapeOval
9
Oval
geoShapeRectangle
1
Rectangle
Center Required Location object. Location representing the center point of the shape.
Width Required Double. The width of the oval or rectangle or the length of the radius, in GeoUnits (miles or kilometers).
Height Required Double. The height of the oval or rectangle or the length of the radius, in GeoUnits (miles or kilometers).

Remarks

Shapes cover a fixed area of the globe and change size on the screen as the map is zoomed in and out. If you want a rectangle of a fixed size, use the AddTextbox method on a Shapes collection to create a text box.

If both the Width and Height parameters are set for a radius circle, the smaller of the two dimensions is used.

To add a new line shape, use the AddLine method on a Shapes collection.

To add a new polyline shape, use the AddPolyline method on a Shapes collection.

To add a new text box shape, use the AddTextbox method on a Shapes collection.

To add a new drivetime zone, use the AddDrivetimeZone method on a Shapes collection.

To learn more about drawing shapes on maps, see the About using shapes in MapPoint topic.

To return or set GeoUnits, use the Units property of an Application or MappointControl object.

Example

    Sub AddRectangleToMap()

  Dim objApp As New MapPoint.Application   Dim objMap As MapPoint.Map   Dim objLoc As MapPoint.Location
  'Set up application and get a location object   Set objMap = objApp.ActiveMap   objApp.Visible = True   objApp.UserControl = True   Set objLoc = objApp.ActiveMap.GetLocation(0, 0)
  'Create a shape at this location, zoom to this location   Set objMap.Location = objLoc   objMap.Shapes.AddShape geoShapeRectangle, objLoc, 50, 30
  End Sub