Mapwingis 5.0.1 tkCursorMode.cmEditShape

private Sub ToolStripButtonZoomIn_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripButtonZoomIn.Click
AxMap1.CursorMode = MapWinGIS.tkCursorMode.cmEditshape
{can not modify polygon shapefile]

Can you show some code so we can try to reproduce?

Is this still an issue with the latest version of MapWinGIS? The previous version had a bug with selection.

Hello @pmeems

Installing the most recent release (v5.4.1), I do not get the exception on the ‘selection’ click or rectangle drag.

Hello @salah

I did a quick review, and modified your code slightly. I think the only real issue may have been setting the Shapefile.InteractiveEditing property = True. I also added a button called ButtonEdit with the code you can see below. With the code below, I was able to

  1. load a Point-based shapefile
  2. click the Edit button
  3. click on one of the point-shapes in the map
  4. drag the point to another position, then, as described in the documentation,
  5. click anywhere else on the map to effectively save the new point position.

Here’s the updated code:

Private _shpfile As Shapefile

Private Sub ButtonAddLayer_Click(sender As Object, e As EventArgs) Handles ButtonAddLayer.Click
    Dim openDlg As OpenFileDialog = New OpenFileDialog()
    Dim handle As Integer
    Dim ext As String = ""

    'initialize dialog
    openDlg.Filter = "Supported Formats|*.shp|Shapefile (*.shp)|*.shp"
    openDlg.CheckFileExists = True

    If (openDlg.ShowDialog(Me) = DialogResult.OK) Then

        'get the extension of the file
        ext = System.IO.Path.GetExtension(openDlg.FileName)

        If ext = ".shp" Then
            ' shpfile is polygon
            _shpfile = New MapWinGIS.ShapefileClass()

            'open the shapefile
            Dim blmCheck As Boolean = _shpfile.Open(openDlg.FileName)

            'add the shapefile to the map
            handle = AxMap1.AddLayer(_shpfile, True)

            AxMap1.Redraw()
        End If
    End If
End Sub

Private Sub ButtonEdit_Click(sender As Object, e As EventArgs) Handles ButtonEdit.Click
    _shpfile.InteractiveEditing = True
    AxMap1.CursorMode = tkCursorMode.cmEditShape
    AxMap1.MapCursor = tkCursor.crsrMapDefault
End Sub

Do you have this problem with all polygon shapefiles or with just one?
Can you share your polygon shapefile? Or check if it’s valid: Shapefile.HasInvalidShapes()

And you are using MapWinGIS v5.0.1?