0

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

我有一个图片框,它已经用 GIF 设置了它的图像,我创建了 2 个事件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;
    }
4

1 回答 1

0

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

于 2013-07-20T13:59:38.653 回答