Invisionsoft
Well-known member
Hello.
I am using the following code (which works fine) to extract icon images from the Windows shell.
However the Alpha chanel areas (soft shadow) show up a horrible black because of this line:
Which converts the handle to a bitmap, which seems to not support Alpha chanels. Is there a way to do the same principle but keep the Alpha chanelling? For example can I cut out the bitmap part and wrap the handle straight to an image or something?
Thanks for great support here
- James
I am using the following code (which works fine) to extract icon images from the Windows shell.
VB.NET:
Public Declare Auto Function ExtractIcon Lib "shell32" (ByVal hInstance As IntPtr,ByVal lpszExeFileName As String,ByVal nIconIndex As Integer) As IntPtr
Public Function geticon(ByVal id As Integer) As Image
Dim hIcon As IntPtr = ExtractIcon(Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0)), "C:\windows\system32\shell32.dll", id)
Return Bitmap.FromHicon(hIcon)
End Function
However the Alpha chanel areas (soft shadow) show up a horrible black because of this line:
VB.NET:
Bitmap.FromHicon(hIcon)
Thanks for great support here
- James