【问题标题】:How to stop GIF at specific Frames in winfoms如何在winforms中的特定帧处停止GIF
【发布时间】:2013-07-19 17:32:52
【问题描述】:

基本上我的问题是如何在特定帧停止 GIF。

我有一个已经用 GIF 设置图像的图片框,我创建了两个事件 EnterLeave

    private void pictureBox1_MouseEnter(object sender, EventArgs e)
    {
        pictureBox1.Image = Properties.Resources.LOGODEFAULT1;
    }
    private void pictureBox1_MouseLeave(object sender, EventArgs e)
    {
        pictureBox1.Image = Properties.Resources.LOGOLEAVE1;
    }

我想要的是在最后一帧停止 GIF(所有 gif 由 7 帧组成) 我尝试了 ImageAnimator 和 ImageStop

 private void pictureBox1_MouseEnter(object sender, EventArgs e)
    {
        ImageAnimator.Animate(pictureBox1.Image, OnFrameChanged1);
    }
    private void pictureBox1_MouseLeave(object sender, EventArgs e)
    {
        ImageAnimator.StopAnimate(pictureBox1.Image, OnFrameChanged2); 
    }
    private void OnFrameChanged1(object sender, EventArgs e)
    {
        pictureBox1.Image = Properties.Resources.LOGODENTER;
    }
    private void OnFrameChanged2(object sender, EventArgs e)
    {
        pictureBox1.Image = Properties.Resources.LOGOLEAVE1;
    }

【问题讨论】:

  • 如何自己创建所有 7 帧并制作动画?
  • 我认为这会导致代码很长?

标签: c# winforms gif


【解决方案1】:

我认为你可以使用Image.SelectActiveFrame Method

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-17
    • 1970-01-01
    • 1970-01-01
    • 2018-06-04
    相关资源
    最近更新 更多