System.Windows.Forms.CustomTabControl.PaintTransparentBackground C# (CSharp) Method

PaintTransparentBackground() protected method

protected PaintTransparentBackground ( Graphics graphics, Rectangle clipRect ) : void
graphics System.Drawing.Graphics
clipRect System.Drawing.Rectangle
return void
        protected void PaintTransparentBackground(Graphics graphics, Rectangle clipRect)
        {
            if ((this.Parent != null)) {

                //	Set the cliprect to be relative to the parent
                clipRect.Offset(this.Location);

                //	Save the current state before we do anything.
                GraphicsState state = graphics.Save();

                //	Set the graphicsobject to be relative to the parent
                graphics.TranslateTransform((float)-this.Location.X, (float)-this.Location.Y);
                graphics.SmoothingMode = SmoothingMode.HighSpeed;

                //	Paint the parent
                PaintEventArgs e = new PaintEventArgs(graphics, clipRect);
                try {
                    this.InvokePaintBackground(this.Parent, e);
                    this.InvokePaint(this.Parent, e);
                } finally {
                    //	Restore the graphics state and the clipRect to their original locations
                    graphics.Restore(state);
                    clipRect.Offset(-this.Location.X, -this.Location.Y);
                }
            }
        }