protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStrip             toolStrip = e.ToolStrip;
            ToolStripDropDownItem item      = e.Item as ToolStripDropDownItem;

            if (item == null)
            {
                return;
            }
            LinearGradientMode    mode      = (toolStrip.Orientation == Orientation.Horizontal) ? LinearGradientMode.Vertical : LinearGradientMode.Horizontal;
            Graphics              graphics  = e.Graphics;
            SmoothingModeGraphics graphics2 = new SmoothingModeGraphics(graphics);
            Rectangle             r         = new Rectangle(Point.Empty, item.Size);

            if (item.Pressed && item.HasDropDownItems)
            {
                if (this.ColorTable.BaseItemDown != null)
                {
                    ImageDrawRect.DrawRect(graphics, (Bitmap)this.ColorTable.BaseItemDown, r, Rectangle.FromLTRB(this.ColorTable.BackRectangle.X, this.ColorTable.BackRectangle.Y, this.ColorTable.BackRectangle.Width, this.ColorTable.BackRectangle.Height), 1, 1);
                }
                else
                {
                    RenderHelper.RenderBackgroundInternal(graphics, r, this.ColorTable.BaseItemPressed, this.ColorTable.BaseItemBorder, this.ColorTable.Back, this.ColorTable.BaseItemRadiusStyle, this.ColorTable.BaseItemRadius, this.ColorTable.BaseItemBorderShow, this.ColorTable.BaseItemAnamorphosis, mode);
                }
            }
            else if (item.Selected)
            {
                if (this.ColorTable.BaseItemDown != null)
                {
                    ImageDrawRect.DrawRect(graphics, (Bitmap)this.ColorTable.BaseItemMouse, r, Rectangle.FromLTRB(this.ColorTable.BackRectangle.X, this.ColorTable.BackRectangle.Y, this.ColorTable.BackRectangle.Width, this.ColorTable.BackRectangle.Height), 1, 1);
                }
                else
                {
                    RenderHelper.RenderBackgroundInternal(graphics, r, this.ColorTable.BaseItemHover, this.ColorTable.BaseItemBorder, this.ColorTable.Back, this.ColorTable.BaseItemRadiusStyle, this.ColorTable.BaseItemRadius, this.ColorTable.BaseItemBorderShow, this.ColorTable.BaseItemAnamorphosis, mode);
                }
            }
            else
            {
                if (toolStrip is ToolStripOverflow)
                {
                    using (Brush brush = new SolidBrush(this.ColorTable.Back))
                    {
                        graphics.FillRectangle(brush, r);
                        goto Label_0256;
                    }
                }
                base.OnRenderDropDownButtonBackground(e);
            }
Label_0256:
            graphics2.Dispose();
        }
 protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e)
 {
     ToolStrip toolStrip = e.ToolStrip;
     ToolStripDropDownItem item = e.Item as ToolStripDropDownItem;
     if (item == null)
     {
         return;
     }
     LinearGradientMode mode = (toolStrip.Orientation == Orientation.Horizontal) ? LinearGradientMode.Vertical : LinearGradientMode.Horizontal;
     Graphics graphics = e.Graphics;
     SmoothingModeGraphics graphics2 = new SmoothingModeGraphics(graphics);
     Rectangle r = new Rectangle(Point.Empty, item.Size);
     if (item.Pressed && item.HasDropDownItems)
     {
         if (this.ColorTable.BaseItemDown != null)
         {
             ImageDrawRect.DrawRect(graphics, (Bitmap) this.ColorTable.BaseItemDown, r, Rectangle.FromLTRB(this.ColorTable.BackRectangle.X, this.ColorTable.BackRectangle.Y, this.ColorTable.BackRectangle.Width, this.ColorTable.BackRectangle.Height), 1, 1);
         }
         else
         {
             RenderHelper.RenderBackgroundInternal(graphics, r, this.ColorTable.BaseItemPressed, this.ColorTable.BaseItemBorder, this.ColorTable.Back, this.ColorTable.BaseItemRadiusStyle, this.ColorTable.BaseItemRadius, this.ColorTable.BaseItemBorderShow, this.ColorTable.BaseItemAnamorphosis, mode);
         }
     }
     else if (item.Selected)
     {
         if (this.ColorTable.BaseItemDown != null)
         {
             ImageDrawRect.DrawRect(graphics, (Bitmap) this.ColorTable.BaseItemMouse, r, Rectangle.FromLTRB(this.ColorTable.BackRectangle.X, this.ColorTable.BackRectangle.Y, this.ColorTable.BackRectangle.Width, this.ColorTable.BackRectangle.Height), 1, 1);
         }
         else
         {
             RenderHelper.RenderBackgroundInternal(graphics, r, this.ColorTable.BaseItemHover, this.ColorTable.BaseItemBorder, this.ColorTable.Back, this.ColorTable.BaseItemRadiusStyle, this.ColorTable.BaseItemRadius, this.ColorTable.BaseItemBorderShow, this.ColorTable.BaseItemAnamorphosis, mode);
         }
     }
     else
     {
         if (toolStrip is ToolStripOverflow)
         {
             using (Brush brush = new SolidBrush(this.ColorTable.Back))
             {
                 graphics.FillRectangle(brush, r);
                 goto Label_0256;
             }
         }
         base.OnRenderDropDownButtonBackground(e);
     }
 Label_0256:
     graphics2.Dispose();
 }
 protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
 {
     ToolStrip toolStrip = e.ToolStrip;
     ToolStripButton item = e.Item as ToolStripButton;
     Graphics graphics = e.Graphics;
     if (item == null)
     {
         return;
     }
     LinearGradientMode mode = (toolStrip.Orientation == Orientation.Horizontal) ? LinearGradientMode.Vertical : LinearGradientMode.Horizontal;
     SmoothingModeGraphics graphics2 = new SmoothingModeGraphics(graphics);
     Rectangle bounds = new Rectangle(Point.Empty, item.Size);
     if (item.BackgroundImage != null)
     {
         Rectangle clipRect = item.Selected ? item.ContentRectangle : bounds;
         ControlPaintEx.DrawBackgroundImage(graphics, item.BackgroundImage, this.ColorTable.Back, item.BackgroundImageLayout, bounds, clipRect);
     }
     if (item.CheckState == CheckState.Unchecked)
     {
         if (item.Selected)
         {
             Bitmap img = item.Pressed ? ((Bitmap) this.ColorTable.BaseItemDown) : ((Bitmap) this.ColorTable.BaseItemMouse);
             if (img != null)
             {
                 ImageDrawRect.DrawRect(graphics, img, bounds, Rectangle.FromLTRB(this.ColorTable.BackRectangle.X, this.ColorTable.BackRectangle.Y, this.ColorTable.BackRectangle.Width, this.ColorTable.BackRectangle.Height), 1, 1);
             }
             else
             {
                 Color baseItemHover = this.ColorTable.BaseItemHover;
                 if (item.Pressed)
                 {
                     baseItemHover = this.ColorTable.BaseItemPressed;
                 }
                 RenderHelper.RenderBackgroundInternal(graphics, bounds, baseItemHover, this.ColorTable.BaseItemBorder, this.ColorTable.Back, this.ColorTable.BaseItemRadiusStyle, this.ColorTable.BaseItemRadius, this.ColorTable.BaseItemBorderShow, this.ColorTable.BaseItemAnamorphosis, mode);
             }
             goto Label_0302;
         }
         if (!(toolStrip is ToolStripOverflow))
         {
             goto Label_0302;
         }
         using (Brush brush = new SolidBrush(this.ColorTable.ItemHover))
         {
             graphics.FillRectangle(brush, bounds);
             goto Label_0302;
         }
     }
     Bitmap baseItemMouse = (Bitmap) this.ColorTable.BaseItemMouse;
     Color baseColor = ControlPaint.Light(this.ColorTable.ItemHover);
     if (item.Selected)
     {
         baseColor = this.ColorTable.ItemHover;
         baseItemMouse = (Bitmap) this.ColorTable.BaseItemMouse;
     }
     if (item.Pressed)
     {
         baseColor = this.ColorTable.ItemPressed;
         baseItemMouse = (Bitmap) this.ColorTable.BaseItemDown;
     }
     if (baseItemMouse == null)
     {
         RenderHelper.RenderBackgroundInternal(graphics, bounds, baseColor, this.ColorTable.BaseItemBorder, this.ColorTable.Back, this.ColorTable.BaseItemRadiusStyle, this.ColorTable.BaseItemRadius, this.ColorTable.BaseItemBorderShow, this.ColorTable.BaseItemAnamorphosis, mode);
     }
     else
     {
         ImageDrawRect.DrawRect(graphics, baseItemMouse, bounds, Rectangle.FromLTRB(this.ColorTable.BackRectangle.X, this.ColorTable.BackRectangle.Y, this.ColorTable.BackRectangle.Width, this.ColorTable.BackRectangle.Height), 1, 1);
     }
 Label_0302:
     graphics2.Dispose();
 }
        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStrip       toolStrip = e.ToolStrip;
            ToolStripButton item      = e.Item as ToolStripButton;
            Graphics        graphics  = e.Graphics;

            if (item == null)
            {
                return;
            }
            LinearGradientMode    mode      = (toolStrip.Orientation == Orientation.Horizontal) ? LinearGradientMode.Vertical : LinearGradientMode.Horizontal;
            SmoothingModeGraphics graphics2 = new SmoothingModeGraphics(graphics);
            Rectangle             bounds    = new Rectangle(Point.Empty, item.Size);

            if (item.BackgroundImage != null)
            {
                Rectangle clipRect = item.Selected ? item.ContentRectangle : bounds;
                ControlPaintEx.DrawBackgroundImage(graphics, item.BackgroundImage, this.ColorTable.Back, item.BackgroundImageLayout, bounds, clipRect);
            }
            if (item.CheckState == CheckState.Unchecked)
            {
                if (item.Selected)
                {
                    Bitmap img = item.Pressed ? ((Bitmap)this.ColorTable.BaseItemDown) : ((Bitmap)this.ColorTable.BaseItemMouse);
                    if (img != null)
                    {
                        ImageDrawRect.DrawRect(graphics, img, bounds, Rectangle.FromLTRB(this.ColorTable.BackRectangle.X, this.ColorTable.BackRectangle.Y, this.ColorTable.BackRectangle.Width, this.ColorTable.BackRectangle.Height), 1, 1);
                    }
                    else
                    {
                        Color baseItemHover = this.ColorTable.BaseItemHover;
                        if (item.Pressed)
                        {
                            baseItemHover = this.ColorTable.BaseItemPressed;
                        }
                        RenderHelper.RenderBackgroundInternal(graphics, bounds, baseItemHover, this.ColorTable.BaseItemBorder, this.ColorTable.Back, this.ColorTable.BaseItemRadiusStyle, this.ColorTable.BaseItemRadius, this.ColorTable.BaseItemBorderShow, this.ColorTable.BaseItemAnamorphosis, mode);
                    }
                    goto Label_0302;
                }
                if (!(toolStrip is ToolStripOverflow))
                {
                    goto Label_0302;
                }
                using (Brush brush = new SolidBrush(this.ColorTable.ItemHover))
                {
                    graphics.FillRectangle(brush, bounds);
                    goto Label_0302;
                }
            }
            Bitmap baseItemMouse = (Bitmap)this.ColorTable.BaseItemMouse;
            Color  baseColor     = ControlPaint.Light(this.ColorTable.ItemHover);

            if (item.Selected)
            {
                baseColor     = this.ColorTable.ItemHover;
                baseItemMouse = (Bitmap)this.ColorTable.BaseItemMouse;
            }
            if (item.Pressed)
            {
                baseColor     = this.ColorTable.ItemPressed;
                baseItemMouse = (Bitmap)this.ColorTable.BaseItemDown;
            }
            if (baseItemMouse == null)
            {
                RenderHelper.RenderBackgroundInternal(graphics, bounds, baseColor, this.ColorTable.BaseItemBorder, this.ColorTable.Back, this.ColorTable.BaseItemRadiusStyle, this.ColorTable.BaseItemRadius, this.ColorTable.BaseItemBorderShow, this.ColorTable.BaseItemAnamorphosis, mode);
            }
            else
            {
                ImageDrawRect.DrawRect(graphics, baseItemMouse, bounds, Rectangle.FromLTRB(this.ColorTable.BackRectangle.X, this.ColorTable.BackRectangle.Y, this.ColorTable.BackRectangle.Width, this.ColorTable.BackRectangle.Height), 1, 1);
            }
Label_0302:
            graphics2.Dispose();
        }