Animatroller.Simulator.Control.Bulb.SimpleBulb.OnPaint C# (CSharp) Метод

OnPaint() защищенный Метод

Handles the Paint event for this UserControl
protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
Результат void
        protected override void OnPaint(PaintEventArgs e)
        {
            if (this.offScreenBitmap == null ||
                this.ClientRectangle.Width != this.offScreenBitmap.Width ||
                this.ClientRectangle.Height != this.offScreenBitmap.Height)
            {
                if (this.offScreenBitmap != null)
                    this.offScreenBitmap.Dispose();

                this.offScreenBitmap = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height);
            }

            using (var g = Graphics.FromImage(this.offScreenBitmap))
            {
                g.SmoothingMode = SmoothingMode.HighQuality;
                // Draw the control
                drawControl(g);
                // Draw the image to the screen
                e.Graphics.DrawImageUnscaled(this.offScreenBitmap, 0, 0);
            }
        }