Quantcast
Channel: MapWinGIS ActiveX Map and GIS Component
Viewing all articles
Browse latest Browse all 2341

New Post: Multi-line Tooltip (VBA)

$
0
0
For anyone else facing the same problem here is the code I'm using:
Private Sub Map1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long) ' Datatips need to add timer
    Dim sf As MapWinGIS.Shapefile
    Dim ex As New MapWinGIS.extents
    Dim xProjected As Double
    Dim yProjected As Double
    Dim ttstr As String
    Dim ShapeIDs As Variant
    Dim ActiveLayer As Long
    Dim result As Boolean
    Dim MyArr As Variant
    Dim i As Long
    ' Add timer code so as to only update if mouse is static for period of time
    If Form1.Map1.CursorMode <> cmIdentify Then Exit Sub ' optional to disable tooltip
    
    ActiveLayer = 0
    Set sf = Form1.Map1.GetObject(ActiveLayer)
    
    Form1.Map1.PixelToProj x, y, xProjected, yProjected
    ex.SetBounds xProjected, yProjected, 0, xProjected, yProjected, 0
    result = sf.SelectShapes(ex, 0, INTERSECTION, ShapeIDs)
    
    If result = True Then
        For i = 0 To UBound(ShapeIDs)
            sf.Labels.Clear
            MyArr = Split(sf.CellValue(2, ShapeIDs(i)), "&")
            ttstr = sf.CellValue(1, ShapeIDs(i)) & vbCrLf & "Colour = " & MyArr(0) & vbCrLf & "LineStyle = " & MyArr(1) & vbCrLf & "Pattern = " & MyArr(2)
            sf.Labels.AddLabel ttstr, xProjected, yProjected
        Next i
    Else
        sf.Labels.Clear
    End If
    
    Form1.Map1.Redraw
End Sub

Viewing all articles
Browse latest Browse all 2341

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>