Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

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.

:)

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...