Private Sub MapImage_MouseLeftButtonUp(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles MapImage.MouseLeftButtonUp If (location IsNot Nothing) Then '=========================================== 'Left Or Right Dim LRMove As Double = ((((e.GetPosition(MapImage).X) / (MapImage.ActualWidth / 100)) - 50) / 10000) * (2.15 * ((15 - zoom) + 1)) 'MsgBox(LRMove) Dim diffLeft As Double Dim shiftLeft As Double If (lng < 178) Then If (zoom = 15) Then lng += LRMove ElseIf (zoom > 15) Then diffLeft = zoom - 15 shiftLeft = ((15 - diffLeft) * LRMove) / 15 lng += shiftLeft Else diffLeft = 15 - zoom shiftLeft = ((15 + diffLeft) * LRMove) / 15 lng += shiftLeft End If Else lng = -180 End If '=============================================== 'Top or Down Dim TDMove As Double = ((((e.GetPosition(MapImage).Y) / (MapImage.ActualHeight / 100)) - 50) / 10000) * (1.5 * ((15 - zoom) + 1)) Dim diffTop As Double Dim shiftTop As Double If (lat > -88) Then If (zoom = 15) Then lat -= TDMove ElseIf (zoom > 15) Then diffTop = zoom - 15 shiftTop = ((15 + diffTop) * TDMove) / 15 lat += shiftTop Else diffTop = 15 - zoom shiftTop = ((15 - diffTop) * TDMove) / 15 lat -= shiftTop End If Else lat = -90 End If '=============================================== 'ShowMapUsingLatLng() ShowMapUsingLatLng() '===================================================== End If End Sub
Private Sub ShowMapUsingLatLng() Dim bmpImage As New BitmapImage() Dim mapURL As String = "http://maps.googleapis.com/maps/api/staticmap?" & _ "center=" & lat & "," & lng & "&" & _ "size=500x400&markers=size:mid%7Ccolor:red%7C" & _ lat & "," & lng & "&zoom=" & zoom & "&maptype=" & mapType & "&sensor=false" '=================== 'Set Latitude and Longitude LatitudeTxtBlck.Text = lat LongitudeTxtBlck.Text = lng '=================== ' My.Computer.FileSystem.WriteAllText("E:\a.txt", mapURL & vbCrLf, True) bmpImage.BeginInit() bmpImage.UriSource = New Uri(mapURL) bmpImage.EndInit() MapImage.Source = bmpImage End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)