Greetings,
I am converting an old VB6 application to use .NET. One of the old controls
loads icons from the disk and displays them. However, the transparent color
turns to blue somewhere in the process. I narrowed it down to the conversion
to IPictureDisp by first loading and saving the icon as a bitmap with no
problems; and then repeating the process but adding the step of converting
to an IPictureDisp as well. The first operation worked fine, the second
resulted in an icon with a blue background. My question: How can I preserve
the transparent color of the original icon while still converting to an
IPictureDisp?
Here's the code:
'As a first step, just load and save the icon as a standard
System.Drawing.Bitmap. Works fine and the icon looks unchanged.
Dim fileImage = New System.Drawing.Bitmap(g_strIconPath & strIcon)
fileImage.Save(g_strToolbarIconPath & "test.bmp")
'Now save it again, but first convert the image to an IPictureDisp and then
back again. Now we have a blue background!!
fileImage = VB6.IPictureDispToImage(VB6.ImageToIPictureDisp(fi leImage))
fileImage.Save(g_strIconPath & "test2.bmp")
Any help greatly appreciated!
Thanks,
Cary