protected override void Dispose(bool disposing)
{
if (disposing)
{
if (IsAnimating)
{
// ReSharper disable once HeapView.DelegateAllocation
ImageAnimator.StopAnimate(Image, OnFrameChangedHandler);
}
if (_hScrollBar != null)
{
Controls.Remove(_hScrollBar);
// ReSharper disable once HeapView.DelegateAllocation
_hScrollBar.Scroll -= ScrollBarScrollHandler;
_hScrollBar.Dispose();
}
if (_vScrollBar != null)
{
Controls.Remove(_vScrollBar);
// ReSharper disable once HeapView.DelegateAllocation
_vScrollBar.Scroll -= ScrollBarScrollHandler;
_vScrollBar.Dispose();
}
if (_texture != null)
{
_texture.Dispose();
_texture = null;
}
if (_gridTile != null)
{
_gridTile.Dispose();
_gridTile = null;
}
}
base.Dispose(disposing);
}