1

I'm trying to get a snapshot of a map with Mapwingis. My problem is that I tried dozen of ways but my picturebox stays desperately empty !

Thanks for any help,

Olivier Mapwingis 4.8.8

1

Here is the result

Public Class Form1

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim image As New MapWinGIS.Image()
        Dim ex As MapWinGIS.Extents
        Try
            'Set extents to be the extents of the map
            ex = CType(Tablet2.WinMap1.Extents, MapWinGIS.Extents)
            'Take a picture of what is being displayed in map1 and store it in image
            image = CType(Tablet2.WinMap1.SnapShot(ex), MapWinGIS.Image)
            PictureBox1.Image = AxHostConverter.PictureDispToImage(CType(image.Picture, stdole.IPictureDisp))
        Catch exc As System.Exception
            MsgBox("")
        End Try
    End Sub
End Class

Friend Class AxHostConverter
    Inherits AxHost
    Private Sub New()
        MyBase.New("")
    End Sub

    Public Shared Function ImageToPictureDisp(image As System.Drawing.Image) As stdole.IPictureDisp
        Return DirectCast(GetIPictureDispFromPicture(image), stdole.IPictureDisp)
    End Function

    Public Shared Function PictureDispToImage(pictureDisp As stdole.IPictureDisp) As System.Drawing.Image
        Return GetPictureFromIPicture(pictureDisp)
    End Function
End Class
  • Is this meant to be the answer? Or are you trying to show the code you need fixed? – BradHards Feb 15 '15 at 3:29
  • It's what I used. I recommend using snapshot3 image = CType(WinMap1.SnapShot3(extent.xMin, extent.xMax, extent.yMax, extent.yMin, PbFtSnap.Width), MapWinGIS.Image) – Olivier Feb 15 '15 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.