目前我可以在我的Bing地图上显示图钉,但我只想在按下另一个按钮时删除它们,在这种情况下我称之为BTNReset。这只是为了使地图在聚集时更加整洁,以便用户可以删除所有不必要的图钉。
Private Sub Berwickshire() Handles BTNCounty.Click
If TXTCounty.Text = "Berwickshire" Then
Dim CountyLocation(20) As Microsoft.Maps.MapControl.WPF.Location
CountyLocation(0) = New Microsoft.Maps.MapControl.WPF.Location(55.705617, -2.4676497)
CountyLocation(1) = New Microsoft.Maps.MapControl.WPF.Location(55.780619, -2.3413039)
CountyLocation(2) = New Microsoft.Maps.MapControl.WPF.Location(55.720304, -2.2638738)
CountyLocation(3) = New Microsoft.Maps.MapControl.WPF.Location(55.746443, -2.2271899)
CountyLocation(4) = New Microsoft.Maps.MapControl.WPF.Location(55.808939, -2.4924539)
CountyLocation(5) = New Microsoft.Maps.MapControl.WPF.Location(55.882232, -2.3064212)
CountyLocation(6) = New Microsoft.Maps.MapControl.WPF.Location(55.852663, -2.3889276)
CountyLocation(7) = New Microsoft.Maps.MapControl.WPF.Location(55.802325, -2.2096172)
CountyLocation(8) = New Microsoft.Maps.MapControl.WPF.Location(55.651853, -2.252035)
CountyLocation(9) = New Microsoft.Maps.MapControl.WPF.Location(55.690431, -2.3361588)
CountyLocation(10) = New Microsoft.Maps.MapControl.WPF.Location(55.645024, -2.3311619)
CountyLocation(11) = New Microsoft.Maps.MapControl.WPF.Location(55.932739, -2.3614317)
CountyLocation(12) = New Microsoft.Maps.MapControl.WPF.Location(55.870455, -2.0969097)
CountyLocation(13) = New Microsoft.Maps.MapControl.WPF.Location(55.852035, -2.1896638)
CountyLocation(14) = New Microsoft.Maps.MapControl.WPF.Location(55.887334, -2.1601164)
CountyLocation(15) = New Microsoft.Maps.MapControl.WPF.Location(55.841716, -2.1222754)
CountyLocation(16) = New Microsoft.Maps.MapControl.WPF.Location(55.771675, -2.803132)
CountyLocation(17) = New Microsoft.Maps.MapControl.WPF.Location(55.719837, -2.750872)
CountyLocation(18) = New Microsoft.Maps.MapControl.WPF.Location(55.680163, -2.5615687)
CountyLocation(19) = New Microsoft.Maps.MapControl.WPF.Location(55.741492, -2.5838242)
CountyLocation(20) = New Microsoft.Maps.MapControl.WPF.Location(55.637369, -2.6798897)
Dim names = New String() {
"Greenlaw",
"Duns",
"Swinton",
"Whitsome",
"Longformacus",
"Grantshouse",
"Abbey St Bathans",
"Chirnside",
"Coldstream",
"Leitholm",
"Birgham",
"Cockburnspath",
"Eyemouth",
"Reston",
"Coldingham",
"Ayton",
"Oxton",
"Lauder",
"Gordon",
"Westruther",
"Earlston"}
For index = 0 To CountyLocation.Length - 1
Dim Pin = New Microsoft.Maps.MapControl.WPF.Pushpin()
Dim CoordinateTip = New System.Windows.Controls.ToolTip()
CoordinateTip.Content = names(index)
Pin.Location = CountyLocation(index)
Pin.ToolTip = CoordinateTip
BingMap.Children.Add(Pin)
Next
End If
End Sub
答案 0 :(得分:0)
您可以执行BingMap.Children.Clear()删除地图上的所有数据。