ImageGlass.ImageBox.DrawBackground C# (CSharp) Method

DrawBackground() protected method

Draws the background of the control.
protected DrawBackground ( PaintEventArgs e ) : void
e PaintEventArgs The instance containing the event data.
return void
        protected virtual void DrawBackground(PaintEventArgs e)
        {
            Rectangle innerRectangle;

            innerRectangle = GetInsideViewPort();

            using (SolidBrush brush = new SolidBrush(BackColor))
            {
                e.Graphics.FillRectangle(brush, innerRectangle);
            }

            if (_texture != null && GridDisplayMode != ImageBoxGridDisplayMode.None)
            {
                switch (GridDisplayMode)
                {
                    case ImageBoxGridDisplayMode.Image:
                        Rectangle fillRectangle;

                        fillRectangle = GetImageViewPort();
                        e.Graphics.FillRectangle(_texture, fillRectangle);
                        break;

                    case ImageBoxGridDisplayMode.Client:
                        e.Graphics.FillRectangle(_texture, innerRectangle);
                        break;
                }
            }
        }
ImageBox