Guest User

Untitled

a guest
Jun 22nd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. Dim CountyLocations(3) As Location
  2. CountyLocations(0) = New Location(55.852663, -2.3889276)
  3. CountyLocations(1) = New Location(55.956023, -3.1607265)
  4. CountyLocations(2) = New Location(54.840279, -3.2886766)
  5. CountyLocations(3) = New Location(52.819511, -1.8851815)
  6.  
  7. For index = 0 to CountyLocations.Length - 1
  8. Dim Pin = New Microsoft.Maps.MapControl.WPF.Pushpin()
  9. Pin.Location = CountyLocations(index)
  10. UserControl11.BingMap.Children.Add(Pin)
  11. Next
  12.  
  13. <Window x:Class="MainWindow"
  14. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  15. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  16. xmlns:wpf="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
  17. Title="MainWindow" Height="350" Width="525">
  18. <Grid>
  19. <wpf:Map x:Name="myMap" ZoomLevel="5" CredentialsProvider="My Key"
  20. Mode="Aerial" Center="55.852663, -2.3889276"></wpf:Map>
  21. </Grid>
  22. </Window>
  23.  
  24. Imports Microsoft.Maps.MapControl.WPF
  25.  
  26. Class MainWindow
  27.  
  28. Public Sub New()
  29. InitializeComponent()
  30. CreatePushPinsWithToolTip()
  31. End Sub
  32.  
  33. Private Sub CreatePushPinsWithToolTip()
  34. Dim CountyLocations(3) As Location
  35. CountyLocations(0) = New Location(55.852663, -2.3889276)
  36. CountyLocations(1) = New Location(55.956023, -3.1607265)
  37. CountyLocations(2) = New Location(54.840279, -3.2886766)
  38. CountyLocations(3) = New Location(52.819511, -1.8851815)
  39.  
  40. For index = 0 To CountyLocations.Length - 1
  41. Dim Pin = New Microsoft.Maps.MapControl.WPF.Pushpin()
  42.  
  43. Dim CoordinateTip As ToolTip = New ToolTip()
  44. CoordinateTip.Content = CountyLocations(index).ToString
  45.  
  46. Pin.Location = CountyLocations(index)
  47. Pin.ToolTip = CoordinateTip
  48. myMap.Children.Add(Pin)
  49. Next
  50. End Sub
  51.  
  52. End Class
  53.  
  54. Private Sub CreatePushPinsWithToolTip()
  55. Dim CountyLocations(3) As Location
  56. CountyLocations(0) = New Location(55.852663, -2.3889276)
  57. CountyLocations(1) = New Location(55.956023, -3.1607265)
  58. CountyLocations(2) = New Location(54.840279, -3.2886766)
  59. CountyLocations(3) = New Location(52.819511, -1.8851815)
  60.  
  61. Dim names = New String() {"sam", "tom", "leon", "eddy"}
  62.  
  63. For index = 0 To CountyLocations.Length - 1
  64. Dim Pin = New Microsoft.Maps.MapControl.WPF.Pushpin()
  65.  
  66. Dim CoordinateTip = New ToolTip()
  67. CoordinateTip.Content = names(index)
  68.  
  69. Pin.Location = CountyLocations(index)
  70. Pin.ToolTip = CoordinateTip
  71. myMap.Children.Add(Pin)
  72. Next
  73. End Sub
Add Comment
Please, Sign In to add comment