Parts list with thumbnail

Parts list with thumbnail

Anonymous
Not applicable
612 Views
1 Reply
Message 1 of 2

Parts list with thumbnail

Anonymous
Not applicable

As an academic interest I was trying to convert Brian’s code for exporting Parts list with thumbnail to VB.net 2012. I just modified the below code to remove the vb6 support. I am using VS 2012 and Inventor 2014. The end result on the word report thumb nail for some parts are not visible. It goes to the error code and putting the text instead of thumb nail. At the same time Brian’s code as it is (used the exe file to install it) works fine on the same parts list with all thumb nail. Can you guide me where I went wrong?

 

#Region "PictureToImageConverter"
    Public NotInheritable Class PictureToImageConverter
        Inherits System.Windows.Forms.AxHost

        Private Sub New()
            MyBase.New(Nothing)
        End Sub

        Public Shared Function Convert(ByVal iPicture As stdole.IPictureDisp) As System.Drawing.Image
            Return CType(System.Windows.Forms.AxHost.GetPictureFromIPicture(iPicture), System.Drawing.Image)
        End Function

    End Class
#End Region



Dim thumbNailPicDisp As stdole.IPictureDisp
                        thumbNailPicDisp = refDoc.Thumbnail

                        Dim thumbNailImage As System.Drawing.Image = PictureToImageConverter.Convert(thumbNailPicDisp)
                        ' Save the thumbnail to a file.
                        Dim thumbFilename As String = System.IO.Path.GetTempPath & "tempthumbnail.bmp"
                        thumbNailImage.Save(thumbFilename)

 

0 Likes
613 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

The error description on the above code is "a generic error occurred in gdi+" . 

 

How can I correct this?

0 Likes