Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
(this one is consequent to this)
Dear @MjDeck
Could you please study the reason for occasional "A generic error occurred in GDI+" for the model attached with the code like:
Option Explicit On
AddReference "Stdole"
AddReference "System.Drawing"
Imports stdole
Imports System.Drawing
Class ThisRule
Sub Main
Dim doc As PartDocument = ThisDoc.Document
Dim cmpDef As ComponentDefinition = doc.ComponentDefinition
Dim thumb As stdole.IPictureDisp = doc.Thumbnail
Dim axHC As New AxHostConverter
Logger.Info("axHC: " & If(axHC Is Nothing, "-", "+"))
Dim image As System.Drawing.Image = axHC.GetImageFromIPictureDisp(thumb) ' A generic error occurred in GDI+
End Sub
End Class
Class AxHostConverter
Inherits System.Windows.Forms.AxHost
Public Sub New()
MyBase.New("{63109182-966B-4e3c-A8B2-8BC4A88D221C}")
' MyBase.New((New Guid).ToString)
End Sub
Public Function GetImageFromIPictureDisp(ByVal IPDisp As stdole.IPictureDisp) As System.Drawing.Image
Return MyBase.GetPictureFromIPicture(IPDisp) ' A generic error occurred in GDI+
End Function
End Class
The code of Class AxHostConverter origins from this post this post of @WCrihfield
The issue can be occasionally (not on each code run) reproduced on Inventor 2024.3 and earlier.
Please vote for Inventor-Idea Text Search within Option Names
Solved! Go to Solution.