Imports DevExpress.XtraMap Public Class frmGeodataSelect Public SelectedPoint As GeoPoint = Nothing Dim _SelectActive As Boolean = False Private BING_KEY As String = "hQUTlqLLK70bETnonpfi~0jx1pIAq1yQ7gXqbIyzKrg~Au-Tewbty8afAxdbNilSv4JlU7qwU-fQKu0ouH9e1uJmpIyVdA3jugVEWMdy1Rbt" Private ReadOnly Property ImageLayer() As ImageTilesLayer Get Return CType(MapControl1.Layers("ImageLayer"), ImageTilesLayer) End Get End Property Private ReadOnly Property VectorLayer() As VectorItemsLayer Get Return CType(MapControl1.Layers("VectorLayer"), VectorItemsLayer) End Get End Property Private ReadOnly Property ItemStorage() As MapItemStorage Get Return CType(VectorLayer.Data, MapItemStorage) End Get End Property Public Sub New(currentPoint As GeoPoint) SelectedPoint = currentPoint Me.InitializeComponent() End Sub Private Sub frmGeodataSelect_Load(sender As Object, e As EventArgs) Handles Me.Load Dim dataProvider As New BingMapDataProvider() dataProvider.BingKey = BING_KEY ImageLayer.DataProvider = dataProvider Dim storage As New MapItemStorage() VectorLayer.Data = storage If SelectedPoint IsNot Nothing Then Dim pin = New MapPushpin() pin.Location = SelectedPoint ItemStorage.Items.Add(pin) txtLat.Text = SelectedPoint.Latitude.ToString() txtLon.Text = SelectedPoint.Longitude.ToString() End If End Sub Private Sub MapControl1_Click(sender As Object, e As MouseEventArgs) Handles MapControl1.Click If e.Button <> Windows.Forms.MouseButtons.Left Then Exit Sub End If If _SelectActive = False Then Exit Sub End If Dim point As GeoPoint = MapControl1.ScreenPointToCoordPoint(e.Location) Dim items As New List(Of MapPushpin) Dim storage As New MapItemStorage() Dim pin = New MapPushpin() pin.Location = point ItemStorage.Items.Clear() ItemStorage.Items.Add(pin) txtLat.Text = point.Latitude.ToString() txtLon.Text = point.Longitude.ToString() SelectedPoint = point End Sub Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click Me.DialogResult = Windows.Forms.DialogResult.OK Me.Close() End Sub Private Sub tsbtnactivate_Click(sender As Object, e As EventArgs) Handles tsbtnactivate.Click If _SelectActive = False Then _SelectActive = True tsbtnactivate.Checked = True Else tsbtnactivate.Checked = False _SelectActive = False End If End Sub End Class