View Single Post

  #2 (permalink)  
Old 07-25-2001
Anonymous Anonymous is offline
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
You would use the AddLine method. This is a code snippet from the
developer's reference in MapPoint Help (it can also be found on MSDN
Library on the web):

<form><textarea wrap="off" readonly="true" name="code" style="BORDER-BOTTOM: gray 1px inset; BORDER-LEFT: gray 1px inset; BORDER-RIGHT: gray 1px inset; BORDER-TOP: gray 1px inset; OVERFLOW: auto; WIDTH: 100%" rows="12" cols="40"> 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 </textarea></form>
Reply With Quote