You have to write a bit of code checking mouse coordinates and marker coordinates setting flags when mouse is over/near marker and then with MouseDown,Dragging,MouseUp,Paint marker at new location.
Good luck
2015-11-04 7:28 GMT+01:00 Aljen <[email removed]>:
From: Aljen
Hi
Could someone give a newbie with the MapWinGIS ActiveX an example or put me in the right direction.
I have succeeded open a .png map and put in the .bmp markers I want on the map.
If I want to drag this markers to a new point, how can I do this?
Public Sub AxMap1MouseDownEvent(sender As Object, e As _DMapEvents_MouseDownEvent)Thanks AndersIf e.button = 1 Then ' left button Dim sf = New Shapefile() sf = New Shapefile() If Not sf.CreateNewWithShapeID("", ShpfileType.SHP_POINT) Then MessageBox.Show("Failed to create shapefile: " + sf.ErrorMsg(sf.LastErrorCode)) Return End If m_layerHandle = AxMap1.AddLayer(sf, True) sf.CollisionMode = tkCollisionMode.AllowCollisions Dim img As New Image img = Me.OpenMarker Dim options As ShapeDrawingOptions = sf.DefaultDrawingOptions options.PointType = tkPointSymbolType.ptSymbolPicture options.Picture = img Dim shp As New Shape() shp.Create(ShpfileType.SHP_POINT) Dim pnt As New Point() Dim x As Double = 0.0 Dim y As Double = 0.0 axMap1.PixelToProj(e.x, e.y, x, y) pnt.x = x pnt.y = y Dim index As Integer = shp.numPoints shp.InsertPoint(pnt, index) index = sf.NumShapes If Not sf.EditInsertShape(shp, index) Then MessageBox.Show("Failed to insert shape: " + sf.ErrorMsg(sf.LastErrorCode)) Return End If axMap1.Redraw() End If End Sub Private Function OpenMarker() As Image Dim path As String = Me.TextBox1.Text ‘Path to icon If Not File.Exists(path) Then MessageBox.Show(Convert.ToString("Can't find the file: ") & path) Else Dim img As New Image() If Not img.Open(path, ImageType.USE_FILE_EXTENSION, True, Nothing) Then MessageBox.Show(img.ErrorMsg(img.LastErrorCode)) img.Close() Else Return img End If End If Return Nothing End Function
Read the full discussion online.
To add a post to this discussion, reply to this email ([email removed])
To start a new discussion for this project, email [email removed]
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online atcodeplex.com