Location property (Shape)
Returns or sets the Location object that represents the center of the specified shape. Fails for lines or freeforms. Read/write.
Applies to
Objects: Shape
Syntax
object.Location
Parameters
Part | Description |
---|---|
object | Required. An expression that returns a Shape object. |
Example
Sub ShapeCenterPushpin()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLoc As MapPoint.Location
'Set up application
Set objMap = objApp.ActiveMap
objApp.Visible = True
objApp.UserControl = True
Set objLoc = objMap.FindResults("Seattle, WA")(1)
'Add a shape, then use its center location to add a Pushpin
Set objMap.Location = objLoc
objMap.Shapes.AddShape geoShapeRectangle, objLoc, 20, 10
objMap.AddPushpin objMap.Shapes.Item(1).Location, "Shape Center"
End Sub
Note This sample code is specific for use in MapPoint North America; it is for illustration purposes only.