如何为GIF动画添加到按钮? [英] How to add animated gif to a button?

查看:199
本文介绍了如何为GIF动画添加到按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能告诉我如何将一个GIF动画添加到C#中的按钮。只需通过添加GIF资源和设置的按钮图像并没有很好地工作(下一帧apear超过previous的)。这个问题似乎是在怎样C#是处理透明度的方式,但我不知道如何解决它。

Can you tell me how to add an animation gif to a button in c#. Just by adding gif to resources and setting as button image didn't work very well (next frames apear over the previous ones). The problem seems to be in a way how c# is treating transparency but I don't know how to fix it.

先谢谢了。

---编辑---

与GIF播放之后的问题是,在GIF透明度。下一帧绘制在previous之一,所以我想成为动画中间透明只是没有做正确(他们仍然有previous框的颜色)的元素。解决方案是建立在下一帧上白色区域覆盖previous之一。白色是我的透明色,所以一切看起来只是罚款之后:)

After playing with the gif the issue was with transparency in gif. Next frame was drawn over the previous one so elements I wanted to become transparent in the middle of the animation just didn't do it properly (they still have the color of the previous frame). Solution was to create white areas on the next frame to cover the previous one. White was my transparent color so everything looked just fine after that :)

我希望有人会看到它是有用的。
快乐编程:)

I hope someone will see it useful. Happy programming :)

推荐答案

我找到了工作。

2的1东西为我工作:

1 of 2 things worked for me:


  1. 我已经重新编辑的GIF添加属性每帧拉开本身。

  1. I've reedited the gif adding property to every frame to undraw itself.

我已经改变VS的版本(我用的是免费提供专业的学生版,现在我
使用一个从MSDN订阅)米

I've changed the version of VS (I was using free professional student version, now I m using one from MSDN subscription)

感谢您的输入家伙。它引导我的结论是,这可能是什么毛病VS本身不符合我的编程风格:)

Thanks for input guys. It guided me to conclusion that that it might be something wrong with VS itself not with my programming style :)

这篇关于如何为GIF动画添加到按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆