How to make a GIF inside a picturebox transparent

piscis

Well-known member
Joined
Jun 30, 2003
Messages
54
How to make a GIF inside a picturebox transparent

Does anyone knows how to make an animated GIF inside a picturebox transparent, so the background of the form can be seen?

Thanks

Andy
 
Code:
Dim b As Bitmap = PictureBox1.Image create a bitmap object
b.MakeTransparent(color you want transparent) set a color transparent
PictureBox1.Image = b reassign modified picture to the pixbox
The key in this code is the MakeTransparent method of the bitmap object. Which will make any color you specify transparent on the bitmap.
:)
 
mutant:

Thanks for your reply

I tried this code and all I got was a statict image showing only the first frame of the Gif Animation. It has the transparent background I wanted but unfortunately no animation or movement at all.

Do you know by any change how to modify this code so the GIF animation animates? Thanks


Private WaterDrops As Bitmap
WaterDrops = PictureBox1.Image
WaterDrops.MakeTransparent(WaterDrops.GetPixel(0, 0))
PictureBox1.Image = WaterDrops
 
Back
Top