View Single Post

  #7 (permalink)  
Old 06-09-2003
Anonymous Anonymous is offline
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
How to disable pushpin movement

Try this:


Private Sub mapMain_SelectionChange(ByVal sender As Object, ByVal e As AxMapPoint._IMappointCtrlEvents_SelectionChangeEve nt) Handles mapVenders.SelectionChange
Dim sp As MapPoint.Shape
Dim loc As MapPoint.Location
Try
If TypeOf (e.pNewSelection) Is MapPoint.Pushpin Then
loc = mapVenders.ActiveMap.GetLocation(80, 0) 'get a location over at the north pole
sp = mapVenders.ActiveMap.Shapes.AddShape(MapPoint.GeoA utoShapeType.geoShapeRectangle, loc, 1, 1)
sp.Select()
sp.Delete()
End If
Catch e1 As Exception
'exit gracefully
End Try
End Sub


Basically what this will do is that every time you select a pushpin then this will create a small, barely noticeable shape over at the north pole, thus shifting the selection to that shape, and then it deletes it so no traces of what happened are left. This will effectively disallow the user from moving pushpins. If you want to leave the pushpin selected, you could try reselecting it with the e.pNewSelection instance, but I'm not sure if the movement will still be disallowed that way. Obviously this is the way that you will know which pushpin was moved, but again I haven't tried if it also has the new location with it. I'm using the method above and has always worked for me, so I guess you won't have any problems with it. Good luck and hope this helps you.
Reply With Quote