MapWindow: Select points

Task:Select points
Select points in a MapWinGIS map.
'set the cursor mode to select
Private Sub SelectToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectToolStripButton.Click
    Me.AxMapPTT.CursorMode = MapWinGIS.tkCursorMode.cmSelection
End Sub

'next get the rubber band box boundaries and create a filter
    Private Sub AxMapPTT_SelectBoxFinal(ByVal sender As System.Object, ByVal e As AxMapWinGIS._DMapEvents_SelectBoxFinalEvent) Handles AxMapPTT.SelectBoxFinal
        AxMapPTT.SendSelectBoxFinal = True
        If AxMapPTT.CursorMode = 3 Then '3 = Select mode
            Dim ProjectedLeft As Double
            Dim ProjectedRight As Double
            Dim ProjectedTop As Double
            Dim ProjectedBottom As Double

            'convert the pixel locations to projected map coordinates
            AxMapPTT.PixelToProj(Left, Top, ProjectedLeft, ProjectedTop)
            AxMapPTT.PixelToProj(Right, Bottom, ProjectedRight, ProjectedBottom)

            'dim up a filter string
            Dim Filter As String
            Filter = "Lat > " & ProjectedBottom & " AND Lat < " & ProjectedTop & " AND Lon > " & ProjectedLeft & " AND Lon < " & ProjectedRight

            'filter the spatial data table
            Me.CaribouLocationsPTTBindingSource.Filter = Filter
        End If
    End Sub
Back to Index