ZForge.Controls.HeaderPanel.DrawBackground C# (CSharp) Method

DrawBackground() private method

private DrawBackground ( PaintEventArgs peArgs, HeaderPanelBorderStyles brdStyle ) : void
peArgs PaintEventArgs
brdStyle HeaderPanelBorderStyles
return void
        private void DrawBackground(PaintEventArgs peArgs, HeaderPanelBorderStyles brdStyle)
        {
            LinearGradientBrush brsh = null;

            try
            {
                if (menm_BorderStyle == HeaderPanelBorderStyles.Shadow)
                {
                    brsh = new LinearGradientBrush(new Rectangle(0, 0, Width - DEFAULT_SHADOW_WIDTH,
                                                                                    Height - DEFAULT_SHADOW_WIDTH), mclr_StartColor,
                                                                                    mclr_EndColor, menm_GradientMode);
                    peArgs.Graphics.FillRectangle(brsh, 0, 0,
                                                                                    Width - DEFAULT_SHADOW_WIDTH,
                                                                                    Height - DEFAULT_SHADOW_WIDTH);
                }
                else
                {
                    brsh = new LinearGradientBrush(new Rectangle(0, 0, Width,
                                                                                    Height), mclr_StartColor,
                                                                                    mclr_EndColor, menm_GradientMode);
                    peArgs.Graphics.FillRectangle(brsh, 0, 0, Width, Height);
                }
            }
            finally
            {
                if (brsh != null)
                {
                    brsh.Dispose();
                    brsh = null;
                }
            }
        }