File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ #Region "Image Converter"
2
+ ' Class used to convert bitmaps and icons between their .Net native types
3
+ ' and an IPictureDisp object which is what the Inventor API requires.
4
+
5
+ <Global.System.Security.Permissions.PermissionSetAttribute _
6
+ (Global.System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")>
7
+ Public Class ConvertImage
8
+ Inherits System.Windows.Forms.AxHost
9
+ Public Sub New()
10
+ MyBase.New("59EE46BA-677D-4d20-BF10-8D8067CB8B32")
11
+ End Sub
12
+
13
+ Public Shared Function ConvertImageToIPictureDisp(ByVal Image As System.Drawing.Image) As stdole.IPictureDisp
14
+ Try
15
+ Return (GetIPictureFromPicture(Image))
16
+ Catch ex As Exception
17
+ Return Nothing
18
+ End Try
19
+ End Function
20
+ Public Shared Function ConvertIconToIPictureDisp(ByVal Icon As System.Drawing.Icon) As stdole.IPictureDisp
21
+ Try
22
+ Return (GetIPictureFromPicture(Icon.ToBitmap)) ' Not sure if this will work correctly
23
+ Catch ex As Exception
24
+ Return Nothing
25
+ End Try
26
+ End Function
27
+
28
+ Public Shared Function ConvertIPictureDispToImage(ByVal IPict As stdole.IPictureDisp) As System.Drawing.Image
29
+ Try
30
+ Return (GetPictureFromIPictureDisp(IPict))
31
+ Catch ex As Exception
32
+ Return Nothing
33
+ End Try
34
+ End Function
35
+ End Class
36
+ #End Region
You can’t perform that action at this time.
0 commit comments