ATMLCommonLibrary.controls.awb.AWBButton.OnPaintBackground C# (CSharp) Method

OnPaintBackground() protected method

protected OnPaintBackground ( PaintEventArgs e ) : void
e PaintEventArgs
return void
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);
            LinearGradientMode mode;
            int tmpShadowOffSet = Math.Min(Math.Min(_shadowOffSet, base.Width - 2), base.Height - 2);
            int tmpSoundCornerRadius = Math.Min(Math.Min(_roundCornerRadius, base.Width - 2), base.Height - 2);
            Rectangle rect = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - tmpShadowOffSet - 1, ClientRectangle.Height - tmpShadowOffSet - 1);
            Rectangle rectShadow = new Rectangle(tmpShadowOffSet, tmpShadowOffSet, ClientRectangle.Width - tmpShadowOffSet - 1, ClientRectangle.Height - tmpShadowOffSet - 1);
            GraphicsPath graphPathShadow = AWBGraphicsPath.GetRoundPath(rectShadow, tmpSoundCornerRadius);
            GraphicsPath graphPath = AWBGraphicsPath.GetRoundPath(rect, tmpSoundCornerRadius);

            //
            // set SmoothingMode
            //
            getSmoothingQuality(e);

            //
            // set LinearGradientMode
            //
            mode = getGradientMode();
            if (_Active)
            {
                switch (_State)
                {
                    case _States.Normal:
                        drawNormalStateBacground(e, mode, ref rect, tmpSoundCornerRadius, graphPathShadow, graphPath);
                        break;

                    case _States.MouseOver:
                        drawHoverStateBackground(e, mode, ref rect, tmpSoundCornerRadius, graphPathShadow, graphPath);
                        break;

                    case _States.Clicked:
                        drawClickStateBackground(e, mode, tmpSoundCornerRadius, tmpShadowOffSet );
                        break;
                }
            }
            else
            {
                drawInactiveStateBackground(e, mode, ref rect, tmpSoundCornerRadius, graphPathShadow, graphPath);
            }
        }