2012-08-13 53 views
1

我使用了this control,但它不支持GIF文件格式,因为图片不像PictureBox那样移动。使用tranparent bg添加GIF图片

+0

你可以从GIF转换你的图片,实际上是支持的格式(PNG也许?) – 2012-08-13 10:06:11

+0

我想我的图片动画! !实际上,这是一个加载的圈子,它的轨道直到加载 – TYeeTY 2012-08-13 10:11:15

回答

0

尝试使用Bitmap.MakeTransparentOnPaint事件ImageAnimator.UpdateFrames简单PictureBox

private Image animGif;// gif animation file 

private void Form1_Load(object sender, EventArgs e) 
{ 
    animGif = new Bitmap("file.png"); 
    ImageAnimator.Animate(animGif, Animate); 
} 

private void pictureBox1_Paint(object sender, PaintEventArgs e) 
{ 
    ImageAnimator.UpdateFrames(); 
    var img = new Bitmap(animGif, animGif.Width, animGif.Height); 
    img.MakeTransparent(Color.White); 
    e.Graphics.Clear(pictureBox1.BackColor); 
    e.Graphics.DrawImage(img, new Point(0, 0)); 
} 

private void Animate(object sender, EventArgs e) 
{ 
    pictureBox1.Invalidate(); 
} 
+0

刚刚停止动画! – TYeeTY 2012-08-13 10:59:27

+0

你也使用过ImageAnimator.Animate吗?我更新了我的回答 – Ria 2012-08-14 06:04:16

+0

@TYeeTY:哈尔? – Ria 2012-08-14 06:18:04