Jump to content

VB.Net Preview Drawing


bigr1822
 Share

Recommended Posts

All,

 

I have created an application that will do some varies tasks.  One of which it will send prints to a printer, or create PDFs.  Here is why my struggles are.  Is there a way to show a preview of the drawing file.  I don't have an exact way that it needs to be done, just need to show a preview of the drawing.  

 

Any starter code would be nice.  I've searched around trying to find some examples for PlotFactory.CreatePreviewEngine, without any luck.

 

Thanks in advance for all your help.

 

Rod

 

 

Link to comment
Share on other sites

  • 3 months later...

Rod,

 

Did you want to use the preview image from the drawing, as used in Explorer?

 

if so then something like this might do the trick, the ides behind each file type are the same so every CAD file these days has an embedded bitmap that explorer can view.

Public Sub PreviewBitmap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PreviewBitmap.Click
        DrawBitmapPreview(aFile)
    End Sub
 
    Private Sub DrawBitmapPreview(ByVal file As IEdmFile5)
        Try
 
            Dim varEnum As IEdmEnumeratorVariable5
            varEnum = file.GetEnumeratorVariable
            Dim preview As IEdmBitmap5
            preview = varEnum.GetThumbnail
            If preview Is Nothing Then Exit Sub
            preview.Draw(Me.Handle.ToInt32(), 45, 220, 0, 0)
 
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

copied from : http://help.solidworks.com/2017/english/api/epdmapi/get_bitmap_preview_of_file_example_vbnet.htm

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...