Quantcast
Viewing all articles
Browse latest Browse all 2341

New Post: Selecting Shape on MouseDown

HI, the code provided by Shade1974

is not working for me can anybody help me,

Dim ext As New MapWinGIS.Extents
    Dim TL, BR As MapWinGIS.Point
    Dim shapes As Object 'Or Variant type in VB6
    Dim shp As Integer
    Dim Buffer As Integer
    TL = New MapWinGIS.Point 'Top Left Projected
    BR = New MapWinGIS.Point 'Bottom Right Projected
    Buffer = 5 'For points and lines give a 5 pixel buffer for selecting the shapes
    'For polygons, select shapes exactly
    If get_myClass() = "Polygon" Then Buffer = 0

    MainMap.PixelToProj(e.x - Buffer, e.y + Buffer, TL.x, TL.y)
    MainMap.PixelToProj(e.x + Buffer, e.y - Buffer, BR.x, BR.y)
    ext = New MapWinGIS.Extents
    ext.SetBounds(TL.x, BR.y, 0, BR.x, TL.y, 0)

    If Not MainParcel.SelectShapes(ext, 0, MapWinGIS.SelectMode.INTERSECTION, shapes) = False Then

        Dim xxx As String
        For shp = 0 To shapes.GetUpperBound(0)
            Dim xx As Integer
            xx = 0

            xxx = MainParcel.Field(2).Name.ToString & " : " & MainParcel.CellValue(2, shapes(shp).ToString)
            MsgBox(xxx)
            Me.TopMost = False
            'Me.AxMap1.CursorMode = MapWinGIS.tkCursorMode.cmNone
            'Me.AxMap1.SendMouseDown = 0
            'FeatureInfo.ShowDialog()
        Next shp
    End If

but when i increase the tolerance the it returns the surrounding shape along with the shape i selected
what happen,:(

Viewing all articles
Browse latest Browse all 2341

Trending Articles