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
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
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