public override void OnRenderTabScrollButtons(RibbonTabRenderEventArgs e)
        {
            if (e.Tab.ScrollLeftVisible)
            {
                if (e.Tab.ScrollLeftSelected)
                {
                    DrawButtonSelected(e.Graphics, e.Tab.ScrollLeftBounds, Corners.West);
                }
                else
                {
                    DrawButton(e.Graphics, e.Tab.ScrollLeftBounds, Corners.West);
                }

                DrawArrowShaded(e.Graphics, e.Tab.ScrollLeftBounds, RibbonArrowDirection.Right, true);

            }

            if (e.Tab.ScrollRightVisible)
            {
                if (e.Tab.ScrollRightSelected)
                {
                    DrawButtonSelected(e.Graphics, e.Tab.ScrollRightBounds, Corners.East);
                }
                else
                {
                    DrawButton(e.Graphics, e.Tab.ScrollRightBounds, Corners.East);
                }

                DrawArrowShaded(e.Graphics, e.Tab.ScrollRightBounds, RibbonArrowDirection.Left, true);
            }
        }
        /// <summary>
        /// Draws a complete tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawCompleteTab(RibbonTabRenderEventArgs e)
        {
            DrawTabActive(e);

            //Background gradient
            using (var path = RoundRectangle(e.Tab.TabContentBounds, 4))
            {
                var north = ColorTable.TabContentNorth;
                var south = ColorTable.TabContentSouth;

                if (e.Tab.Contextual)
                {
                    north = ColorTable.DropDownBg;
                    south = north;
                }

                using (var b = new LinearGradientBrush(
                    new Point(0, e.Tab.TabContentBounds.Top + 30),
                    new Point(0, e.Tab.TabContentBounds.Bottom - 10), north, south))
                {
                    b.WrapMode = WrapMode.TileFlipXY;
                    e.Graphics.FillPath(b, path);
                }
            }

            //Glossy effect
            var glossy = Rectangle.FromLTRB(e.Tab.TabContentBounds.Left, e.Tab.TabContentBounds.Top + 0, e.Tab.TabContentBounds.Right, e.Tab.TabContentBounds.Top + 18);
            using (var path = RoundRectangle(glossy, 6, Corners.NorthWest | Corners.NorthEast))
            {
                using (var b = new SolidBrush(Color.FromArgb(30, Color.White)))
                {
                    e.Graphics.FillPath(b, path);
                }
            }

            //Tab border
            using (var path = CreateCompleteTabPath(e.Tab))
            {
                using (var p = new Pen(ColorTable.TabBorder))
                {
                    e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                    e.Graphics.DrawPath(p, path);
                }
            }

            if (e.Tab.Selected)
            {
                //Selected glow
                using (var path = CreateTabPath(e.Tab))
                {
                    var p = new Pen(Color.FromArgb(150, Color.Gold)) {Width = 2};

                    e.Graphics.DrawPath(p, path);

                    p.Dispose();
                }
            }
        }
 public override void OnRenderRibbonTab(RibbonTabRenderEventArgs e)
 {
     if (e.Tab.Active)
     {
         DrawCompleteTab(e);
     }
     else if (e.Tab.Pressed)
     {
         DrawTabPressed(e);
     }
     else if (e.Tab.Selected)
     {
         DrawTabSelected(e);
     }
     else
     {
         DrawTabNormal(e);
     }
 }
        public override void OnRenderRibbonTabText(RibbonTabRenderEventArgs e)
        {
            var sf = new StringFormat();

            sf.Alignment = StringAlignment.Center;
            sf.Trimming = StringTrimming.EllipsisCharacter;
            sf.LineAlignment = StringAlignment.Center;
            sf.FormatFlags |= StringFormatFlags.NoWrap;

            var r = Rectangle.FromLTRB(
                e.Tab.TabBounds.Left + e.Ribbon.TabTextMargin.Left,
                e.Tab.TabBounds.Top + e.Ribbon.TabTextMargin.Top,
                e.Tab.TabBounds.Right - e.Ribbon.TabTextMargin.Right,
                e.Tab.TabBounds.Bottom - e.Ribbon.TabTextMargin.Bottom);

            using (Brush b = new SolidBrush(GetTextColor(true, e.Tab.Active ? ColorTable.TabActiveText : ColorTable.TabText )))
            {
                e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                e.Graphics.DrawString(e.Tab.Text, e.Ribbon.Font, b, r, sf);
            }
        }
 /// <summary>
 /// Draws a pressed tab
 /// </summary>
 /// <param name="e"></param>
 public void DrawTabPressed(RibbonTabRenderEventArgs e)
 {
 }
        /// <summary>
        /// Draws a selected tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawTabSelected(RibbonTabRenderEventArgs e)
        {
            var outerR = Rectangle.FromLTRB(
                e.Tab.TabBounds.Left,
                e.Tab.TabBounds.Top,
                e.Tab.TabBounds.Right - 1,
                e.Tab.TabBounds.Bottom);
            var innerR = Rectangle.FromLTRB(
                outerR.Left + 1,
                outerR.Top + 1,
                outerR.Right - 1,
                outerR.Bottom);

            var glossyR = Rectangle.FromLTRB(
                innerR.Left + 1,
                innerR.Top + 1,
                innerR.Right - 1,
                innerR.Top + e.Tab.TabBounds.Height / 2);

            var outer = RoundRectangle(outerR, 3, Corners.NorthEast | Corners.NorthWest);
            var inner = RoundRectangle(innerR, 3, Corners.NorthEast | Corners.NorthWest);
            var glossy = RoundRectangle(glossyR, 3, Corners.NorthEast | Corners.NorthWest);

            using (var p = new Pen(ColorTable.TabBorder))
            {
                e.Graphics.DrawPath(p, outer);
            }

            using (var p = new Pen(Color.FromArgb(200, Color.White)))
            {
                e.Graphics.DrawPath(p, inner);
            }

            using (var radialPath = new GraphicsPath())
            {
                radialPath.AddRectangle(innerR);
                radialPath.CloseFigure();

                var gr = new PathGradientBrush(radialPath)
                             {
                                 CenterPoint = new PointF(
                                     Convert.ToSingle(innerR.Left + innerR.Width/2),
                                     Convert.ToSingle(innerR.Top - 5)),
                                 CenterColor = Color.Transparent,
                                 SurroundColors = new[] {ColorTable.TabSelectedGlow}
                             };
                var blend = new Blend(3)
                                {
                                    Factors = new[] {0.0f, 0.9f, 0.0f},
                                    Positions = new[] {0.0f, 0.8f, 1.0f}
                                };

                gr.Blend = blend;

                e.Graphics.FillPath(gr, radialPath);

                gr.Dispose();
            }
            using (var b = new SolidBrush(Color.FromArgb(100, Color.White)))
            {
                e.Graphics.FillPath(b, glossy);
            }

            outer.Dispose();
            inner.Dispose();
            glossy.Dispose();
        }
        /// <summary>
        /// Draws a complete tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawTabNormal(RibbonTabRenderEventArgs e)
        {
            var lastClip = e.Graphics.ClipBounds;

            var clip = Rectangle.FromLTRB(
                e.Tab.TabBounds.Left,
                e.Tab.TabBounds.Top,
                e.Tab.TabBounds.Right,
                e.Tab.TabBounds.Bottom);

            var r = Rectangle.FromLTRB(
                e.Tab.TabBounds.Left - 1,
                e.Tab.TabBounds.Top - 1,
                e.Tab.TabBounds.Right,
                e.Tab.TabBounds.Bottom);

            e.Graphics.SetClip(clip);

            using (Brush b = new SolidBrush(ColorTable.RibbonBackground))
            {
                e.Graphics.FillRectangle(b, r);
            }

            e.Graphics.SetClip(lastClip);
        }
        /// <summary>
        /// Draws an active tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawTabActive(RibbonTabRenderEventArgs e)
        {
            DrawTabNormal(e);

            var glossy = new Rectangle(e.Tab.TabBounds.Left, e.Tab.TabBounds.Top, e.Tab.TabBounds.Width, 4);
            var shadow = e.Tab.TabBounds;
            shadow.Offset(2, 1);
            var tab = e.Tab.TabBounds;

            using (var path = RoundRectangle(shadow, 6, Corners.NorthWest | Corners.NorthEast))
            {
                using (var b = new PathGradientBrush(path))
                {
                    b.WrapMode = WrapMode.Clamp;

                    var cb = new ColorBlend(3);
                    cb.Colors = new []{Color.Transparent,
                                       Color.FromArgb(50, Color.Black),
                                       Color.FromArgb(100, Color.Black)};
                    cb.Positions = new [] { 0f, .1f, 1f };

                    b.InterpolationColors = cb;

                    e.Graphics.FillPath(b, path);
                }
            }

            using (var path = RoundRectangle(tab, 6, Corners.North))
            {
                using (var p = new Pen(ColorTable.TabNorth, 1.6f))
                {
                    e.Graphics.DrawPath(p, path);
                }

                using (var b = new LinearGradientBrush(
                    e.Tab.TabBounds, ColorTable.TabNorth, ColorTable.TabSouth, 90))
                {
                    e.Graphics.FillPath(b, path);
                }
            }

            using (var path = RoundRectangle(glossy, 6, Corners.North))
            {
                using (var b = new SolidBrush(Color.FromArgb(180, Color.White)))
                {
                    e.Graphics.FillPath(b, path);
                }
            }
        }
 /// <summary>
 /// Call to draw the scroll buttons on the tab
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderTabScrollButtons(RibbonTabRenderEventArgs e)
 {
 }
 /// <summary>
 /// Renders the text of the tab specified on the event
 /// </summary>
 /// <param name="e">Event data and paint tools</param>
 public virtual void OnRenderRibbonTabText(RibbonTabRenderEventArgs e)
 {
 }
 /// <summary>
 /// Renders the background of the content of the specified tab
 /// </summary>
 /// <param name="e">Event data and paint tools</param>
 public virtual void OnRenderRibbonTabContentBackground(RibbonTabRenderEventArgs e)
 {
 }