c# 如何在图片框中制作我的 gif 动画循环
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/459074/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
c# How can I make my gif animation loop in a picturebox
提问by Brad
I have imported an animated GIF as a resource into a picturebox - unfortunitly it only plays to the end frame and never repeats. Id there something I could do to make it loop continiously. The gif is for my "please wait busy box"
我已将动画 GIF 作为资源导入到图片框中 - 不幸的是它只播放到结束帧而不会重复。我可以做些什么来让它不断循环。gif 是给我的“请等待繁忙的盒子”
Brad
布拉德
采纳答案by Dan Herbert
Animated GIFs have a few different settings. Usually, embedded in the file is some data that tells the renderer how the image should be displayed.
动画 GIF 有一些不同的设置。通常,文件中嵌入的一些数据告诉渲染器应该如何显示图像。
This data says how fast the image is animated, if it should loop infinitely, or how many times it should repeat.
该数据表示图像动画的速度,是否应该无限循环,或者应该重复多少次。
There are severalprograms availablethat you can use to edit an animated GIF and change the looping settings.
First, I'd open your GIF in some app to preview it to see if it loops before trying to alter the image.
首先,在尝试更改图像之前,我会在某个应用程序中打开您的 GIF 以预览它以查看它是否循环。
回答by Guido Zanon
You can use the System.Drawing.ImageAnimatorclass helper. You have the Animate, UpdateFrames, and StopAnimate methods to control the loop.
您可以使用System.Drawing.ImageAnimator类助手。您可以使用 Animate、UpdateFrames 和 StopAnimate 方法来控制循环。