protected override void OnPaint(PaintEventArgs pe)
{
if (this.pictureBoxState[0x20])
{
try
{
if (this.WaitOnLoad)
{
this.Load();
}
else
{
this.LoadAsync();
}
}
catch (Exception exception)
{
if (ClientUtils.IsCriticalException(exception))
{
throw;
}
this.image = this.ErrorImage;
}
}
if (this.image != null)
{
this.Animate();
ImageAnimator.UpdateFrames();
Rectangle rect = (this.imageInstallationType == ImageInstallationType.ErrorOrInitial) ? this.ImageRectangleFromSizeMode(PictureBoxSizeMode.CenterImage) : this.ImageRectangle;
pe.Graphics.DrawImage(this.image, rect);
}
base.OnPaint(pe);
}
转载于:https://www.cnblogs.com/jiangj/archive/2010/09/03/1816853.html