Quantcast
Viewing all articles
Browse latest Browse all 2341

New Post: Microsoft Access 2007 Application.GlobalCallback not triggering/ program freezing

Thanks again for the reply. I've tried using the TilesLoaded method many times with no success.

My only issue in translating from C# to VBA is the equivalent of the line:

axMap1.TilesLoaded += axMap1_TilesLoaded;

Even without an equivalent event assignment, I can get the TilesLoaded method to fire as you suggested, using the system time and a unique ID.
Public Sub CheckPrefetch()

    //load map as usual

    timeString = CStr(Now)
    Dim width As Integer
    width = axMap.width * 2
    
    axMap.LockWindow tkLockMode.lmLock
    axMap.LoadTilesForSnapshot axMap.extents, width, timeString, axMap.TileProvider
           
End Function

Private Sub axMap_TilesLoaded(ByVal SnapShot As Boolean, ByVal Key As String)

    If SnapShot And Key = timeString Then

        Dim myImage As New MapWinGIS.image
        myImage.UpsamplingMode = imHighQualityBicubic
        Set myImage = axMap.SnapShot3(axMap.extents.xMin, axMap.extents.xMax, axMap.extents.yMax, axMap.extents.yMin, axMap.width * 2)
        myImage.Save "C:\temp.jpg"
    
    End If

End Sub
However, I'm having an issue with scaling. When I set the Access map control to 512px (5.333") the debugger tells me that the axMap.width = 7,680. At that width, it seems that the Snapshot3 method fails, since the resulting image is too large. Setting any control width below 256px seems to result in either a crash or an image with severe scaling issues, presumably since the form isn't wide enough for even a single tile.

I can successfully take an image by hard coding a smaller width:
Set myImage = axMap.SnapShot3(axMap.extents.xMin, axMap.extents.xMax, axMap.extents.yMax, axMap.extents.yMin, 1024)
But the resulting snapshot has no tiles at all, even when setting the corresponding LoadTilesForSnapshot to the same resolution (1024 in that case). Obviously printing the snapshot again, after the tiles has buffered, does work, but it never seems to complete successfully the first time around.

Any advice you could give is appreciated.

Viewing all articles
Browse latest Browse all 2341

Trending Articles



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