Convert Thumbnail to image

Convert Thumbnail to image

Anonymous
Not applicable
769 Views
1 Reply
Message 1 of 2

Convert Thumbnail to image

Anonymous
Not applicable

Hello

 

the Thumbnail is in IPictureDisp format, and the picturebox requires an image.

 

How can it be converted?


The sugestion found on the fourms to use VB6 does not seem to work anymore. (removed because obsolete, and not compatible with 64 bit system)

 

In the addin template there is the image converter that converts from image to IPictureDisp but not the inverse.

 

Thank you!

0 Likes
Accepted solutions (1)
770 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

Solved with this code:

 

 

 

Public NotInheritable Class IPictureDispConverter : Inherits System.Windows.Forms.AxHost

        Private Sub New()

            MyBase.New("")

        End Sub


        Public Shared Function ImageToPictureDisp(image As Image) As IPictureDisp

            Try

                Return DirectCast(GetIPictureDispFromPicture(image), IPictureDisp)

            Catch ex As Exception

                'Add error message or logging here if desired.

                'Handle the conversion error by simply returning Nothing.

                Return Nothing

            End Try

        End Function



        Public Shared Function PictureDispToImage(pictureDisp As IPictureDisp) As Image

            Try

                Return GetPictureFromIPicture(pictureDisp)

            Catch ex As Exception

                'Add error message or logging here if desired.

                'Handle the conversion error by simply returning Nothing.

                Return Nothing

            End Try

        End Function

    End Class
0 Likes