gif图像,但不保持循环 [英] a gif image without keep looping

查看:76
本文介绍了gif图像,但不保持循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一张gif图像,它循环播放一次,然后停止.

我将该图像加载到图片框中.

我的问题是图像不断循环播放.我希望它在第一次循环后停止.我该怎么办?

我使用以下代码加载图像.

谢谢.

我写了以下代码:

Hello everybody,

I have a gif image, which loop one time and it stop.

I load that image into the picturebox.

My problem is that the image keep looping. I want it to stop after it loop the first time. How can I do that ?

I use the following code to load the image.

thanks.

I wrote following code :

Dim y As New System.Guid
Dim x As Drawing.Imaging.FrameDimension = New Drawing.Imaging.FrameDimension(y)
y = PictureBox1.Image.FrameDimensionsList(0)

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
   If PictureBox1.Image.SelectActiveFrame(x, 0) = 19 Then
      PictureBox1.Enabled = False
      Timer1.Stop()
   End If
End Sub


并发生此错误:
GDI +中发生一般错误.


And this error occurs:
A generic error occurred in GDI+.

推荐答案

有关图像动画制作速度以及是否循环播放的数据已嵌入图像本身,而PictureBox无法直接访问它.

但是,在System.Drawing名称空间中找到的ImageAnimator对象可以访问它.我没有任何使用经验,因此无法为您提供任何代码,但是您应该可以在网络上找到信息和示例.
Data on how fast the image animates and whether to loop or not is embedded in the image itself, and the PictureBox cannot access this directly.

However, the ImageAnimator object, found in the System.Drawing namespace, can access it. I don''t have any experience using it so I cannot provide any code for you, but you should be able to find information and examples on the web.


这篇关于gif图像,但不保持循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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