OnPaint事件

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);
}

posted on 2010-09-03 11:38  shaya  阅读(465)  评论(0编辑  收藏  举报

导航