AnsweredAssumed Answered

Get thumbnail for a document

Question asked by Charly Orley Castrillon Madrid on Apr 13, 2018
Latest reply on Jun 1, 2018 by Hakan Bi̇rcan

Hi Evereybody, and thanks in advance for your help

I apologize for my bad english.

I'm writing an add in for solidworks 2017 and I need to show in a picture box the thumbnail of a document selected in a treeview in a windows form that is runnig in solidworks.

I'm trying to use the next function but null image is been returned.

 

    Public Function GetPreview(ByVal file As String) As System.Drawing.Image

        Dim pvf As New wpfPreviewFlowControl.wpfThumbnailCreator

        pvf = New wpfPreviewFlowControl.wpfThumbnailCreator()

        Dim size As System.Drawing.Size

        size.Width = 300 ' SIZE OF PREVIEW

        size.Height = 300 ' SIZE OF PREVIEW

        pvf.DesiredSize = size

        GetPreview = pvf.GetThumbNail(file) 'GetPreview is being returned NULL

    End Function

 

Does anyone know why i'm getting a null image? If it isn't the correct way to get the thumbnail, does anyone know how to do it? As i said before, the form is running in solidworks so i don't have problems to open the document and read it.

Outcomes