基本上我的问题是如何在特定帧停止 GIF。
我有一个图片框,它已经用 GIF 设置了它的图像,我创建了 2 个事件Enter
和Leave
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;
}