AddLine method
Adds a new line to the map between two points. Returns the newly created Shape object with a Type property of geoLine.
Applies to
Collections: Shapes
Syntax
object.AddLine(BeginLocation, EndLocation)
Parameters
Part | Description |
---|---|
object | Required. An expression that returns a Shapes collection. |
BeginLocation | Required Location object. The starting point of the line. |
EndLocation | Required Location object. The ending point of the line. |
Remarks
To learn more about drawing shapes on maps, see the About using shapes in MapPoint topic.
Example
Sub AddLineToMap()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLoc1 As MapPoint.Location
Dim objLoc2 As MapPoint.Location
'Set up the application
Set objMap = objApp.ActiveMap
objApp.Visible = True
objApp.UserControl = True
'Get two locations and zoom to it
Set objLoc1 = objMap.FindResults("Seattle, WA").Item(1)
Set objLoc2 = objMap.FindResults("Redmond, WA").Item(1)
Set objMap.Location = objLoc1
'Add a Line from one location to the other
objMap.Shapes.AddLine objLoc1, objLoc2
End Sub
Note This sample code is specifically for use in MapPoint North America; it is for illustration purposes only.