public void Dispose() { Active = false; timer.Stop(); Image?.Dispose(); Image = null; ShowImage?.Dispose(); ShowImage = null; }
public void JumpToFrame(int frameIndex) { if (ImageCount == 0) { return; } if (frameIndex >= 0 && frameIndex < ImageCount) { if (ShowImage == null || ShowImage.Width != Image.Width || ShowImage.Height != Image.Height) { ShowImage?.Dispose(); ShowImage = new Bitmap(Image.Width, Image.Height); } FrameDimension fd = Image.GifFrameDimension(); Image.SelectActiveFrame(fd, frameIndex); ShowImage.Graphics().DrawImage(Image, 0, 0, Image.Width, Image.Height); ImageChanged?.Invoke(this, ShowImage); } }