protected virtual void OnPaint(DrawExtensionEventArgs e)
 {
     if (this.Paint != null)
     {
         this.Paint(this, e);
     }
 }
        internal void Draw(Graphics gr, Color parentColor)
        {
            bool   flag = true;
            Region clip = null;
            DrawExtensionEventArgs e  = null;
            Graphics backgroundBuffer = this.GetBackgroundBuffer();

            if (backgroundBuffer != null)
            {
                if (this._backgroundValid)
                {
                    flag = false;
                }
                else
                {
                    e = new DrawExtensionEventArgs(backgroundBuffer, new Rectangle(0, 0, this._bounds.Width, this._bounds.Height), parentColor);
                }
            }
            else
            {
                clip = gr.Clip;
                Region helperRegion = Resco.Controls.ScrollBar.ScrollBar.GetHelperRegion();
                helperRegion.MakeEmpty();
                helperRegion.Union(this._bounds);
                gr.Clip = helperRegion;
                e       = new DrawExtensionEventArgs(gr, this._bounds, parentColor);
            }
            if (flag)
            {
                this.OnPaint(e);
                this._backgroundValid = e.Graphics == backgroundBuffer;
            }
            if ((e == null) || (e.Graphics == backgroundBuffer))
            {
                gr.DrawImage(this._backgroundBufferBitmap, this._bounds.Left, this._bounds.Top);
            }
            if (clip != null)
            {
                gr.Clip = clip;
            }
        }
 protected virtual void OnPaint(DrawExtensionEventArgs e)
 {
     if (this.Paint != null)
     {
         this.Paint(this, e);
     }
 }
 internal void Draw(Graphics gr, Color parentColor)
 {
     bool flag = true;
     Region clip = null;
     DrawExtensionEventArgs e = null;
     Graphics backgroundBuffer = this.GetBackgroundBuffer();
     if (backgroundBuffer != null)
     {
         if (this._backgroundValid)
         {
             flag = false;
         }
         else
         {
             e = new DrawExtensionEventArgs(backgroundBuffer, new Rectangle(0, 0, this._bounds.Width, this._bounds.Height), parentColor);
         }
     }
     else
     {
         clip = gr.Clip;
         Region helperRegion = Resco.Controls.ScrollBar.ScrollBar.GetHelperRegion();
         helperRegion.MakeEmpty();
         helperRegion.Union(this._bounds);
         gr.Clip = helperRegion;
         e = new DrawExtensionEventArgs(gr, this._bounds, parentColor);
     }
     if (flag)
     {
         this.OnPaint(e);
         this._backgroundValid = e.Graphics == backgroundBuffer;
     }
     if ((e == null) || (e.Graphics == backgroundBuffer))
     {
         gr.DrawImage(this._backgroundBufferBitmap, this._bounds.Left, this._bounds.Top);
     }
     if (clip != null)
     {
         gr.Clip = clip;
     }
 }