today a small code snippet for the subject notify icon with transparency.
I couldn’t figure out how to create a normal *.ico with transparency. At least my program wasn’t supporting this feature. So I was creating my own code and needed to trick around a bit The code can be used also for some other work, I think.
It works very easy. In my case I have an image list with several pictures. I just select one and set it up as notify icon.
The sub looks like that. It need to be run with the program start of course.
That’s it. Now your program has an notify icon with background transparency
' sets a new icon from the imagelist. because of the transparens Sub createNotifyIcon() Try Dim img As Bitmap = Me.ImageList1.Images(1) Dim hIcon As IntPtr = img.GetHicon() Dim icn As Icon = Drawing.Icon.FromHandle(hIcon) Me.NotifyIcon1.Icon = icn icn = Nothing hIcon = Nothing img = Nothing Catch exc As Exception 'ups, error... hope the icon is still there... End Try End Sub