I'm developing an application in MS Access 2016 using the MapWinGIS.ocx. My code is working reasonably well but I need to add some simple functionality (like adding labels to markers on the map).
My markers are created manually using the DrawWideCircleEx function inside a loop based on an Access recordset. The markers are drawn correctly on a layer added to the map. Immediately after drawing the marker I try to apply a label to it using the DrawLabel function. I've debugged the code and find that the DrawLabel function seems to crash Access - immediately.
I'm not absolutely sure this is the appropriate forum for asking for help or if anyone has encountered this problem, but any suggestion / help is greatly appreciated - and thanks in advance.
Here's a snippet of the code that's causing the crash.
The offending statement labelReturn = CountyMap.DrawLabel("Text", pX, pY, 0) is commented out for now.
Do While Not rst3.EOF
mapLat = rst3!D_LATITUDE
mapLon = rst3!D_LONGITUDE
markerSize = rst3!D_GTOTAL / 1000
xlate = CountyMap.DegreesToPixel(mapLon, mapLat, pX, pY)
If (xlate) Then
Select Case markerSize
Case Is >= 20
markerSize = CountyMap.DrawWideCircleEx(hndDrawLayer, pX, pY, 16, RGB(255, 0, 0), False, 2)
'labelReturn = CountyMap.DrawLabel("Text", pX, pY, 0)
Case Is >= 10
markerSize = CountyMap.DrawWideCircleEx(hndDrawLayer, pX, pY, 8, RGB(255, 0, 0), False, 2)
Case Else
markerSize = CountyMap.DrawWideCircleEx(hndDrawLayer, pX, pY, 4, RGB(255, 0, 0), False, 2)
End Select
Else
End If
rst3.MoveNext
Loop
Comments: After spending the day experimenting and searching for clues I still can't get the DrawLabel() function to work. Any assistance would be greatly appreciated.
My markers are created manually using the DrawWideCircleEx function inside a loop based on an Access recordset. The markers are drawn correctly on a layer added to the map. Immediately after drawing the marker I try to apply a label to it using the DrawLabel function. I've debugged the code and find that the DrawLabel function seems to crash Access - immediately.
I'm not absolutely sure this is the appropriate forum for asking for help or if anyone has encountered this problem, but any suggestion / help is greatly appreciated - and thanks in advance.
Here's a snippet of the code that's causing the crash.
The offending statement labelReturn = CountyMap.DrawLabel("Text", pX, pY, 0) is commented out for now.
Do While Not rst3.EOF
mapLat = rst3!D_LATITUDE
mapLon = rst3!D_LONGITUDE
markerSize = rst3!D_GTOTAL / 1000
xlate = CountyMap.DegreesToPixel(mapLon, mapLat, pX, pY)
If (xlate) Then
Select Case markerSize
Case Is >= 20
markerSize = CountyMap.DrawWideCircleEx(hndDrawLayer, pX, pY, 16, RGB(255, 0, 0), False, 2)
'labelReturn = CountyMap.DrawLabel("Text", pX, pY, 0)
Case Is >= 10
markerSize = CountyMap.DrawWideCircleEx(hndDrawLayer, pX, pY, 8, RGB(255, 0, 0), False, 2)
Case Else
markerSize = CountyMap.DrawWideCircleEx(hndDrawLayer, pX, pY, 4, RGB(255, 0, 0), False, 2)
End Select
Else
End If
rst3.MoveNext
Loop
Comments: After spending the day experimenting and searching for clues I still can't get the DrawLabel() function to work. Any assistance would be greatly appreciated.