/// <summary>
        /// Draws a selected tab
        /// </summary>
        /// <param name="e"></param>
        //Michael Spradlin - 05/03/2013 Office 2013 Style Changes
        public void DrawTabMinimized(RibbonTabRenderEventArgs e)
        {
            if (e.Tab.Invisible)
                return;

            if (e.Tab.Selected)
            {
                #region Office_2007

                if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
                {
                    Rectangle outerR = Rectangle.FromLTRB(
                          e.Tab.TabBounds.Left,
                          e.Tab.TabBounds.Top,
                          e.Tab.TabBounds.Right - 1,
                          e.Tab.TabBounds.Bottom);
                    Rectangle innerR = Rectangle.FromLTRB(
                         outerR.Left + 1,
                         outerR.Top + 1,
                         outerR.Right - 1,
                         outerR.Bottom);

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

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

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

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

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

                        PathGradientBrush gr = new PathGradientBrush(radialPath);
                        gr.CenterPoint = new PointF(
                             Convert.ToSingle(innerR.Left + innerR.Width / 2),
                             Convert.ToSingle(innerR.Top - 5));
                        gr.CenterColor = Color.Transparent;
                        gr.SurroundColors = new Color[] { ColorTable.TabSelectedGlow };

                        Blend blend = new Blend(3);
                        blend.Factors = new float[] { 0.0f, 0.9f, 0.0f };
                        blend.Positions = new float[] { 0.0f, 0.8f, 1.0f };

                        gr.Blend = blend;

                        e.Graphics.FillPath(gr, radialPath);

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

                    outer.Dispose();
                    inner.Dispose();
                    glossy.Dispose();
                }

                #endregion

                #region Office_2010

                if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
                {
                    //background
                    Rectangle outerR = Rectangle.FromLTRB(e.Tab.TabBounds.Left, e.Tab.TabBounds.Top, e.Tab.TabBounds.Right - 1, e.Tab.TabBounds.Bottom);
                    Rectangle innerR = Rectangle.FromLTRB(outerR.Left + 1, outerR.Top + 1, outerR.Right - 1, outerR.Bottom);
                    Rectangle glossyR = Rectangle.FromLTRB(innerR.Left + 1, innerR.Top + 1, innerR.Right - 1, innerR.Top + e.Tab.TabBounds.Height);

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

                    //Tab border
                    using (GraphicsPath path = CreateTabPath_2010(e.Tab))
                    {
                        using (Pen p = new Pen(ColorTable.TabSelectedBorder))
                        {
                            SmoothingMode sm = e.Graphics.SmoothingMode;
                            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                            e.Graphics.DrawPath(p, path);
                            e.Graphics.SmoothingMode = sm;
                        }
                    }

                    //Interior shading and highlight
                    using (GraphicsPath radialPath = new GraphicsPath())
                    {
                        radialPath.AddRectangle(innerR);
                        radialPath.CloseFigure();

                        LinearGradientBrush b = new LinearGradientBrush(innerR, Color.FromArgb(50, Color.Gray), Color.FromArgb(80, Color.White), 90);

                        Blend blend = new Blend(3);
                        blend.Factors = new float[] { 0.0f, 0.6f, 1.0f };
                        blend.Positions = new float[] { 0.0f, 0.2f, 1.0f };

                        b.Blend = blend;

                        e.Graphics.FillPath(b, radialPath);

                        b.Dispose();
                    }

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

                #endregion

                #region Office_2013

                if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
                {
                    //background
                    Rectangle outerR = Rectangle.FromLTRB(e.Tab.TabBounds.Left, e.Tab.TabBounds.Top, e.Tab.TabBounds.Right - 1, e.Tab.TabBounds.Bottom);
                    Rectangle innerR = Rectangle.FromLTRB(outerR.Left + 1, outerR.Top + 1, outerR.Right - 1, outerR.Bottom);
                    Rectangle glossyR = Rectangle.FromLTRB(innerR.Left + 1, innerR.Top + 1, innerR.Right - 1, innerR.Top + e.Tab.TabBounds.Height);

                    GraphicsPath outer = FlatRectangle(outerR);
                    GraphicsPath inner = FlatRectangle(innerR);
                    GraphicsPath glossy = FlatRectangle(glossyR);

                    using (SolidBrush b = new SolidBrush(ColorTable.ButtonSelected_2013))
                    {
                        e.Graphics.FillPath(b, outer);
                    }

                    //Tab border
                    using (GraphicsPath path = CreateTabPath_2013(e.Tab))
                    {
                        using (Pen p = new Pen(ColorTable.ButtonSelected_2013))
                        {
                            SmoothingMode sm = e.Graphics.SmoothingMode;
                            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                            e.Graphics.DrawPath(p, path);
                            e.Graphics.SmoothingMode = sm;
                        }
                    }
                }

                #endregion

            }
            else
            {
                RectangleF lastClip = e.Graphics.ClipBounds;

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

                Rectangle 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);

                if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
                {
                    using (Brush b = new SolidBrush(ColorTable.RibbonBackground))
                    {
                        e.Graphics.FillRectangle(b, r);
                    }
                }
                if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
                {
                    if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
                    {
                        WinApi.FillForGlass(e.Graphics, r);
                    }
                    else
                    {
                        using (Brush b = new SolidBrush(ColorTable.RibbonBackground))
                        {
                            e.Graphics.FillRectangle(b, r);
                        }
                    }
                }
                if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
                {
                    if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
                    {
                        WinApi.FillForGlass(e.Graphics, r);
                    }
                    else
                    {
                        using (Brush b = new SolidBrush(ColorTable.RibbonBackground_2013))
                        {
                            e.Graphics.FillRectangle(b, r);
                        }
                    }
                }
                e.Graphics.SetClip(lastClip);
            }
        }
 /// <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>
        /// Draws an active tab
        /// </summary>
        /// <param name="e"></param>
        //Michael Spradlin - 05/03/2013 Office 2013 Style Changes
        public void DrawTabActive(RibbonTabRenderEventArgs e)
        {
            if (e.Tab.Invisible)
                return;

            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007 || e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
            {
                Rectangle glossy = new Rectangle(e.Tab.TabBounds.Left, e.Tab.TabBounds.Top, e.Tab.TabBounds.Width, 4);
                Rectangle shadow = e.Tab.TabBounds; shadow.Offset(2, 1);
                Rectangle tab = e.Tab.TabBounds; //tab.Inflate(0, 1);

                if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
                {
                    //Shadow
                    using (GraphicsPath path = RoundRectangle(shadow, 6, Corners.NorthWest | Corners.NorthEast))
                    {
                        using (PathGradientBrush b = new PathGradientBrush(path))
                        {
                            b.WrapMode = WrapMode.Clamp;

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

                            b.InterpolationColors = cb;

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

                using (GraphicsPath path = RoundRectangle(tab, 6, Corners.North))
                {
                    Color north = ColorTable.TabNorth;
                    Color south = ColorTable.TabSouth;

                    if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
                    {
                        using (Pen p = new Pen(north, 1.6f))
                        {
                            e.Graphics.DrawPath(p, path);
                        }
                    }

                    //Tab background
                    using (LinearGradientBrush b = new LinearGradientBrush(
                            e.Tab.TabBounds, north, south, 90))
                    {
                        e.Graphics.FillPath(b, path);
                    }
                }

                if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
                {
                    // Highlight on tip of tab
                    using (GraphicsPath path = RoundRectangle(glossy, 6, Corners.North))
                    {
                        using (Brush b = new SolidBrush(Color.FromArgb(180, Color.White)))
                        {
                            e.Graphics.FillPath(b, path);
                        }
                    }
                }
            }
            else if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
            {
                Rectangle tab = new Rectangle(e.Tab.TabBounds.Left, e.Tab.TabBounds.Top, e.Tab.TabBounds.Width, e.Tab.TabBounds.Height + 1);

                using (GraphicsPath path = FlatRectangle(tab))
                {
                    using (SolidBrush b = new SolidBrush(ColorTable.TabActiveBackbround_2013))
                    {
                        e.Graphics.FillPath(b, path);
                    }
                }
            }
        }
        /// <summary>
        /// Draws a selected (mouse over) tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawTabSelected(RibbonTabRenderEventArgs e)
        {
            if (e.Tab.Invisible)
                return;

            #region Office_2007

            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
            {
                Rectangle outerR = Rectangle.FromLTRB(
                      e.Tab.TabBounds.Left,
                      e.Tab.TabBounds.Top,
                      e.Tab.TabBounds.Right - 1,
                      e.Tab.TabBounds.Bottom);
                Rectangle innerR = Rectangle.FromLTRB(
                     outerR.Left + 1,
                     outerR.Top + 1,
                     outerR.Right - 1,
                     outerR.Bottom);

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

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

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

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

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

                    PathGradientBrush gr = new PathGradientBrush(radialPath);
                    gr.CenterPoint = new PointF(
                         Convert.ToSingle(innerR.Left + innerR.Width / 2),
                         Convert.ToSingle(innerR.Top - 5));
                    gr.CenterColor = Color.Transparent;
                    gr.SurroundColors = new Color[] { ColorTable.TabSelectedGlow };

                    Blend blend = new Blend(3);
                    blend.Factors = new float[] { 0.0f, 0.9f, 0.0f };
                    blend.Positions = new float[] { 0.0f, 0.8f, 1.0f };

                    gr.Blend = blend;

                    e.Graphics.FillPath(gr, radialPath);

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

                outer.Dispose();
                inner.Dispose();
                glossy.Dispose();
            }

            #endregion

            #region Office_2010

            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
            {
                //background
                Rectangle outerR = Rectangle.FromLTRB(e.Tab.TabBounds.Left, e.Tab.TabBounds.Top, e.Tab.TabBounds.Right - 1, e.Tab.TabBounds.Bottom);
                Rectangle innerR = Rectangle.FromLTRB(outerR.Left + 1, outerR.Top + 1, outerR.Right - 1, outerR.Bottom);
                Rectangle glossyR = Rectangle.FromLTRB(innerR.Left + 1, innerR.Top + 1, innerR.Right - 1, innerR.Top + e.Tab.TabBounds.Height);

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

                if (e.Tab.Contextual)
                {
                    using (GraphicsPath path = RoundRectangle(outerR, 6, Corners.North))
                    {

                     Color north = Color.FromArgb(200, e.Tab.Context.GlowColor);
                     Color centre = Color.FromArgb(40, e.Tab.Context.GlowColor);
                     Color south = Color.FromArgb(0, e.Tab.Context.GlowColor);
                        
                        //Tab background
                        using (LinearGradientBrush b = new LinearGradientBrush(
                                e.Tab.TabBounds, north, south, 90))
                        {
                            ColorBlend cb = new ColorBlend(3);
                            cb.Colors = new Color[] { north, centre, south };
                            cb.Positions = new float[] { 0f, .3f, 1f };
                            b.InterpolationColors = cb;
                    
                            e.Graphics.FillPath(b, path);
                        }
                    }
                }

                //Tab border
                using (GraphicsPath path = CreateTabPath_2010(e.Tab))
                {
                    using (Pen p = new Pen(ColorTable.TabSelectedBorder))
                    {
                        SmoothingMode sm = e.Graphics.SmoothingMode;
                        e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                        e.Graphics.DrawPath(p, path);
                        e.Graphics.SmoothingMode = sm;
                    }
                }

                //Interior shading and highlight
                using (GraphicsPath radialPath = new GraphicsPath())
                {
                    radialPath.AddRectangle(innerR);
                    radialPath.CloseFigure();

                    LinearGradientBrush b = new LinearGradientBrush(innerR, Color.FromArgb(50, Color.Gray), Color.FromArgb(80, Color.White), 90);

                    Blend blend = new Blend(3);
                    blend.Factors = new float[] { 0.0f, 0.6f, 1.0f };
                    blend.Positions = new float[] { 0.0f, 0.2f, 1.0f };

                    b.Blend = blend;

                    e.Graphics.FillPath(b, radialPath);

                    b.Dispose();
                }

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

				outer.Dispose();
				inner.Dispose();
				glossy.Dispose();
            }

            #endregion

            #region Office_2013

            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
            {
                //background
				Rectangle outerR = Rectangle.FromLTRB(e.Tab.TabBounds.Left, e.Tab.TabBounds.Top, e.Tab.TabBounds.Right - 1, e.Tab.TabBounds.Bottom);
				Rectangle innerR = Rectangle.FromLTRB(outerR.Left + 1, outerR.Top + 1, outerR.Right - 1, outerR.Bottom);
				//Rectangle glossyR = Rectangle.FromLTRB(innerR.Left + 1, innerR.Top + 1, innerR.Right - 1, innerR.Top + e.Tab.TabBounds.Height);

				//Tab border
				using(GraphicsPath path=CreateTabPath_2013(e.Tab))
				{
					using(Pen p=new Pen(ColorTable.TabSelectedBorder))
					{
						SmoothingMode sm=e.Graphics.SmoothingMode;
						e.Graphics.SmoothingMode=SmoothingMode.AntiAlias;
						e.Graphics.DrawPath(p, path);
						e.Graphics.SmoothingMode=sm;
					}
				}

				//Interior shading and highlight
				using(GraphicsPath radialPath=new GraphicsPath())
				{
					radialPath.AddRectangle(innerR);
					radialPath.CloseFigure();

					LinearGradientBrush b=new LinearGradientBrush(innerR, Color.FromArgb(50, Color.Gray), Color.FromArgb(80, Color.White), 90);

					Blend blend=new Blend(3);
					blend.Factors=new float[] { 0.0f, 0.6f, 1.0f };
					blend.Positions=new float[] { 0.0f, 0.2f, 1.0f };

					b.Blend=blend;

					e.Graphics.FillPath(b, radialPath);

					b.Dispose();
				}

				//Interior white line
				using(GraphicsPath inner=FlatRectangle(innerR))
				{
					using(Pen p=new Pen(Color.FromArgb(200, Color.White)))
					{
						e.Graphics.DrawPath(p, inner);
					}
				}
            }

            #endregion
        }
Exemple #5
0
 /// <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)
 {
 }
        public override void OnRenderTabScrollButtons(RibbonTabRenderEventArgs e)
        {
            if (e.Tab.ScrollLeftVisible)
            {
                if (e.Tab.ScrollLeftSelected)
                {
                    DrawButtonSelected(e.Graphics, e.Tab.ScrollLeftBounds, Corners.West, e.Ribbon);
                }
                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, e.Ribbon);
                }
                else
                {
                    DrawButton(e.Graphics, e.Tab.ScrollRightBounds, Corners.East);
                }

                DrawArrowShaded(e.Graphics, e.Tab.ScrollRightBounds, RibbonArrowDirection.Left, true);
            }
        }
        /// <summary>
        /// Draws highlights of an acive and selected tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawTabActiveSelected(RibbonTabRenderEventArgs e)
        {
            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
            {
                //Selected glow
                using (GraphicsPath path = CreateTabPath_2010(e.Tab))
                {
                    Pen p = new Pen(Color.FromArgb(150, Color.Gold));
                    p.Width = 2;

                    e.Graphics.DrawPath(p, path);

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

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

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

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

                    b.InterpolationColors = cb;

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

            using (GraphicsPath path = RoundRectangle(tab, 6, Corners.North))
            {
                Color north = ColorTable.TabNorth;
                Color south = ColorTable.TabSouth;

                if (e.Tab.Contextual)
                {
                    north = e.Tab.Context.GlowColor;
                    south = Color.FromArgb(10, north);
                }

                using (Pen p = new Pen(ColorTable.TabNorth, 1.6f))
                {
                    e.Graphics.DrawPath(p, path);
                }

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

            using (GraphicsPath path = RoundRectangle(glossy, 6, Corners.North))
            {
                using (Brush b = new SolidBrush(Color.FromArgb(180, Color.White)))
                {
                    e.Graphics.FillPath(b, path);
                }
            }
        }
        /// <summary>
        /// Draws a selected tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawTabMinimized(RibbonTabRenderEventArgs e)
        {
            if (e.Tab.Selected)
            {
                //background
                Rectangle outerR = Rectangle.FromLTRB(
                     e.Tab.TabBounds.Left,
                     e.Tab.TabBounds.Top,
                     e.Tab.TabBounds.Right - 1,
                     e.Tab.TabBounds.Bottom);
                Rectangle innerR = Rectangle.FromLTRB(
                     outerR.Left + 1,
                     outerR.Top + 1,
                     outerR.Right - 1,
                     outerR.Bottom);

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

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

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

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

                //Selected glow
                using (GraphicsPath path = CreateTabPath(e.Tab))
                {
                    Pen p = new Pen(Color.FromArgb(150, Color.FromArgb(252, 184, 11)));
                    p.Width = 2;

                    e.Graphics.DrawPath(p, path);

                    p.Dispose();
                }
            }
            else
            {
                RectangleF lastClip = e.Graphics.ClipBounds;

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

                Rectangle 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 a complete tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawTabNormal(RibbonTabRenderEventArgs e)
        {
            RectangleF lastClip = e.Graphics.ClipBounds;

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

            Rectangle 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);

            //Michael Spradlin - 05/03/2013 Office 2013 Style Changes
            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007 | e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
            {
                using (Brush b = new SolidBrush(Theme.ColorTable.RibbonBackground))
                {
                    e.Graphics.FillRectangle(b, r);
                }
            }
            else if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
            {
                using (Brush b = new SolidBrush(Theme.ColorTable.TabNormalBackground_2013))
                {
                    e.Graphics.FillRectangle(b, r);
                }
            }

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

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

                if (e.Tab.Contextual)
                {
                    north = ColorTable.DropDownBg;
                    south = north;
                }
                int tabCenter = e.Tab.TabContentBounds.Height / 2;

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

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

            //Tab border

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

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

                    e.Graphics.DrawPath(p, path);

                    p.Dispose();
                }
            }
        }
        public override void OnRenderRibbonTabText(RibbonTabRenderEventArgs e)
        {
            StringFormat sf = new StringFormat();

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

            Rectangle 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);

            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007 | e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010) //Michael Spradlin - 05/03/2013 Office 2013 Style Changes
            {
                using (Brush b = new SolidBrush(GetTextColor(true, e.Tab.Active ? Theme.ColorTable.TabActiveText : Theme.ColorTable.TabText)))
                {
                    e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                    e.Graphics.DrawString(e.Tab.Text, e.Ribbon.RibbonTabFont, b, r, sf);
                }
            }
            else if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
            {
                using (Brush b = new SolidBrush(GetTextColor(true, e.Tab.Active | e.Tab.Selected ? Theme.ColorTable.TabText_2013 : Theme.ColorTable.TabTextSelected_2013)))
                {
                    e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                    e.Graphics.DrawString(e.Tab.Text, e.Ribbon.RibbonTabFont, b, r, sf);
                }
            }
        }
 public override void OnRenderRibbonTab(RibbonTabRenderEventArgs e)
 {
     if (e.Ribbon.Minimized && !e.Ribbon.Expanded)
     {
         DrawTabMinimized(e);
     }
     else if (e.Tab.Active)
     {
         DrawCompleteTab(e);
     }
     else if (e.Tab.Pressed)
     {
         //DrawTabPressed(e);
     }
     else if (e.Tab.Selected)
     {
         if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010 | e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013) //Michael Spradlin - 05/03/2013 Office 2013 Style Changes
             DrawTabMinimized(e);
         else if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
             DrawTabSelected(e);
     }
     else
     {
         DrawTabNormal(e);
     }
 }
 /// <summary>
 /// Call to draw the scroll buttons on the tab
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderTabScrollButtons(RibbonTabRenderEventArgs e)
 {
 }
        public override void OnRenderRibbonTab(RibbonTabRenderEventArgs e)
        {
            if (e.Ribbon.Minimized && !e.Ribbon.Expanded)
            {
                DrawTabMinimized(e);
            }
            else if (e.Tab.Active)
            {
                DrawTabNormal(e);
                DrawTabActive(e);
                DrawCompleteTab(e);

                if (e.Tab.Selected && !e.Tab.Invisible)
                {
                    DrawTabActiveSelected(e);
                }
            }
            else if (e.Tab.Pressed)
            {
                //DrawTabPressed(e);
            }
            else if (e.Tab.Selected)
            {
                DrawTabNormal(e);
                DrawTabSelected(e);
            }
            else
            {
                DrawTabNormal(e);
            }
        }
        /// <summary>
        /// Draws a complete tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawTabNormal(RibbonTabRenderEventArgs e)
        {
            RectangleF lastClip = e.Graphics.ClipBounds;

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

            Rectangle 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);
        }
        public override void OnRenderRibbonTabText(RibbonTabRenderEventArgs e)
        {
            StringFormat sf = StringFormatFactory.CenterNoWrapTrimEllipsis();

            if (e.Ribbon.AltPressed)
            {

                sf.HotkeyPrefix = Drawing.Text.HotkeyPrefix.Show;

            }
            else
            {

                sf.HotkeyPrefix = Drawing.Text.HotkeyPrefix.Hide;
            }

            Rectangle 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);

            var tabText = e.Tab.Text;

            tabText = FormatText(tabText, e.Tab.AltKey, e.Ribbon.AltPressed);

            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007 || e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010) //Michael Spradlin - 05/03/2013 Office 2013 Style Changes
            {
                using (Brush b = new SolidBrush(GetTextColor(true, e.Tab.Active ? ColorTable.TabActiveText : ColorTable.TabText)))
                {
                    if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
                    {
                        GraphicsPath p = new GraphicsPath();

                        float emSize = e.Graphics.DpiY * e.Ribbon.RibbonTabFont.Size / 72;
                        p.AddString(tabText, e.Ribbon.RibbonTabFont.FontFamily, 0, emSize, r, sf);

                        SmoothingMode sbuff = e.Graphics.SmoothingMode;
                        e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
                        e.Graphics.FillPath(b, p);
                        e.Graphics.SmoothingMode = sbuff;
                    }
                    else
                    {
                        e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
                        e.Graphics.DrawString(tabText, e.Ribbon.RibbonTabFont, b, r, sf);
                    }
                }
            }
            else if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
            {
                using (Brush b = new SolidBrush(GetTextColor(true, e.Tab.Active || e.Tab.Selected ? ColorTable.TabText_2013 : ColorTable.TabTextSelected_2013)))
                {
                    if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
                    {
                        GraphicsPath p = new GraphicsPath();

                        float emSize = e.Graphics.DpiY * e.Ribbon.RibbonTabFont.Size / 72;
                        p.AddString(tabText, e.Ribbon.RibbonTabFont.FontFamily, 0, emSize, r, sf);

                        SmoothingMode sbuff = e.Graphics.SmoothingMode;
                        e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
                        e.Graphics.FillPath(b, p);
                        e.Graphics.SmoothingMode = sbuff;
                    }
                    else
                    {
                        e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
                        e.Graphics.DrawString(tabText, e.Ribbon.RibbonTabFont, b, r, sf);
                    }
                }
            }
        }
        /// <summary>
        /// Draws a selected tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawTabSelected(RibbonTabRenderEventArgs e)
        {
            Rectangle outerR = Rectangle.FromLTRB(
                 e.Tab.TabBounds.Left,
                 e.Tab.TabBounds.Top,
                 e.Tab.TabBounds.Right - 1,
                 e.Tab.TabBounds.Bottom);
            Rectangle innerR = Rectangle.FromLTRB(
                 outerR.Left + 1,
                 outerR.Top + 1,
                 outerR.Right - 1,
                 outerR.Bottom);

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

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

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

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

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

                PathGradientBrush gr = new PathGradientBrush(radialPath);
                gr.CenterPoint = new PointF(
                     Convert.ToSingle(innerR.Left + innerR.Width / 2),
                     Convert.ToSingle(innerR.Top - 5));
                gr.CenterColor = Color.Transparent;
                gr.SurroundColors = new Color[] { ColorTable.TabSelectedGlow };

                Blend blend = new Blend(3);
                blend.Factors = new float[] { 0.0f, 0.9f, 0.0f };
                blend.Positions = new float[] { 0.0f, 0.8f, 1.0f };

                gr.Blend = blend;

                e.Graphics.FillPath(gr, radialPath);

                gr.Dispose();
            }
            using (SolidBrush 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>
        //Michael Spradlin - 05/03/2013 Office 2013 Style Changes
        public void DrawCompleteTab(RibbonTabRenderEventArgs e)
        {
            #region Office_2007
           if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
            {
                //Background (content) gradient
                using (GraphicsPath path = RoundRectangle(e.Tab.TabContentBounds, 4))
                {
                    Color north = ColorTable.TabContentNorth;
                    Color south = ColorTable.TabContentSouth;

                    if (e.Tab.Contextual)
                    {
                        north = ColorTable.DropDownBg;
                        south = north;
                    }
                    int tabCenter = e.Tab.TabContentBounds.Height / 2;

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

                //Glossy effect in tab content
                if (e.Tab.Invisible == false)
                {
                    Rectangle glossy = Rectangle.FromLTRB(e.Tab.TabContentBounds.Left, e.Tab.TabContentBounds.Top + 1, e.Tab.TabContentBounds.Right, e.Tab.TabContentBounds.Top + 18);
                    using (GraphicsPath path = RoundRectangle(glossy, 6, Corners.NorthWest | Corners.NorthEast))
                    {
                        using (Brush b = new SolidBrush(Color.FromArgb(30, Color.White)))
                        {
                            SmoothingMode sm = e.Graphics.SmoothingMode;
                            e.Graphics.SmoothingMode = SmoothingMode.None;
                            e.Graphics.FillPath(b, path);
                            e.Graphics.SmoothingMode = sm;
                        }
                    }
                }

                //Tab border
                using (GraphicsPath path = CreateCompleteTabPath_2007(e.Tab))
                {
                    using (Pen p = new Pen(ColorTable.TabBorder))
                    {
                        SmoothingMode sm = e.Graphics.SmoothingMode;
                        e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                        e.Graphics.DrawPath(p, path);
                        e.Graphics.SmoothingMode = sm;
                    }
                }
            }
            #endregion

            #region Office_2010

         if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
            {
                //Background (content) gradient
                using (GraphicsPath path = FlatRectangle(e.Tab.TabContentBounds))
                {
                    Color north = ColorTable.TabContentNorth;
                    Color south = ColorTable.TabContentSouth;

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

                    using (LinearGradientBrush b = new LinearGradientBrush(
                         new Point(0, e.Tab.TabContentBounds.Top),
                         new Point(0, e.Tab.TabContentBounds.Bottom), north, south))
                    {
                        SmoothingMode sm = e.Graphics.SmoothingMode;
                        e.Graphics.SmoothingMode = SmoothingMode.None;
                        e.Graphics.FillPath(b, path);
                        e.Graphics.SmoothingMode = sm;
                    }
                }

                //Tab border (top)
                using (GraphicsPath path = CreateCompleteTopTabPath_2010(e.Tab))
                {
                    using (Pen p = new Pen(ColorTable.TabBorder))
                    {
                        SmoothingMode sm = e.Graphics.SmoothingMode;
                        e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                        e.Graphics.DrawPath(p, path);
                        e.Graphics.SmoothingMode = sm;
                    }
                }

                //Tab border (bottom)
                using (GraphicsPath path = new GraphicsPath())
                {
                    path.AddLine(e.Tab.TabContentBounds.Right, e.Tab.TabContentBounds.Bottom, e.Tab.TabContentBounds.Left, e.Tab.TabContentBounds.Bottom);
                    using (Pen p = new Pen(ColorTable.TabBorder))
                    {
                        SmoothingMode sm = e.Graphics.SmoothingMode;
                        e.Graphics.SmoothingMode = SmoothingMode.None;
                        e.Graphics.DrawPath(p, path);
                        e.Graphics.SmoothingMode = sm;
                    }
                }

            }

            #endregion

            #region Office_2013

       if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
            {
                //Background
                using (GraphicsPath path = FlatRectangle(e.Tab.TabContentBounds))
                {
                    using (SolidBrush b = new SolidBrush(ColorTable.TabCompleteBackground_2013))
                    {
                        SmoothingMode sm = e.Graphics.SmoothingMode;
                        e.Graphics.SmoothingMode = SmoothingMode.None;
                        e.Graphics.FillPath(b, path);
                        e.Graphics.SmoothingMode = sm;
                    }
                }

                //Tab border
                using (GraphicsPath path = CreateCompleteTabPath_2013(e.Tab))
                {
                    using (Pen p = new Pen(ColorTable.TabBorder_2013))
                    {
                        SmoothingMode sm = e.Graphics.SmoothingMode;
                        e.Graphics.SmoothingMode = SmoothingMode.None;
                        e.Graphics.DrawPath(p, path);
                        e.Graphics.SmoothingMode = sm;
                    }
                }
            }

            #endregion
                 
        }
 public override void OnRenderRibbonTab(RibbonTabRenderEventArgs e)
 {
     if (e.Ribbon.Minimized && !e.Ribbon.Expanded)
     {
         DrawTabMinimized(e);
     }
     else if (e.Tab.Active)
     {
         DrawCompleteTab(e);
     }
     else if (e.Tab.Pressed)
     {
         DrawTabPressed(e);
     }
     else if (e.Tab.Selected)
     {
         if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
             DrawTabMinimized(e);
         else
             DrawTabSelected(e);
     }
     else
     {
         DrawTabNormal(e);
     }
 }
        /// <summary>
        /// Draws a complete tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawTabNormal(RibbonTabRenderEventArgs e)
        {
            if (e.Tab.Invisible)
                return;

            RectangleF lastClip = e.Graphics.ClipBounds;

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

            Rectangle 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);

            #region Office_2007

            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
            {
                using (Brush b = new SolidBrush(ColorTable.RibbonBackground))
                {
                    e.Graphics.FillRectangle(b, r);
                }


                using (GraphicsPath path = FlatRectangle(e.Tab.Bounds))
                {
                    Color north = ColorTable.TabNorth;
                    Color centre = ColorTable.TabSouth;
                    Color south = ColorTable.TabSouth;

                    if (e.Tab.Contextual)
                    {
                        north = Color.FromArgb(40, e.Tab.Context.GlowColor);
                        centre = Color.FromArgb(20, e.Tab.Context.GlowColor);
                        south = Color.FromArgb(0, e.Tab.Context.GlowColor);

                        //Tab background
                        using (LinearGradientBrush b = new LinearGradientBrush(
                                r, north, south, 90))
                        {
                            ColorBlend cb = new ColorBlend(3);
                            cb.Colors = new Color[] { north, centre, south };
                            cb.Positions = new float[] { 0f, .3f, 1f };
                            b.InterpolationColors = cb;

                            SmoothingMode sm = e.Graphics.SmoothingMode;
                            e.Graphics.SmoothingMode = SmoothingMode.None;
                            e.Graphics.FillPath(b, path);
                            e.Graphics.SmoothingMode = sm;
                        }
                    }
                }
            }          
            
            #endregion

            #region Office_2010

            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
            {
                if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
                {
                    WinApi.FillForGlass(e.Graphics, r);
                }
                else
                {
                    using (Brush b = new SolidBrush(ColorTable.RibbonBackground))
                    {
                        e.Graphics.FillRectangle(b, r);
                    }
                }

                using (GraphicsPath path = FlatRectangle(e.Tab.Bounds))
                {
                    Color north = ColorTable.TabNorth;
                    Color centre = ColorTable.TabSouth;
                    Color south = ColorTable.TabSouth;

                    if (e.Tab.Contextual)
                    {
                        north = Color.FromArgb(40, e.Tab.Context.GlowColor);
                        centre = Color.FromArgb(20, e.Tab.Context.GlowColor);
                        south = Color.FromArgb(0, e.Tab.Context.GlowColor);

                        //Tab background
                        using (LinearGradientBrush b = new LinearGradientBrush(
                                r, north, south, 90))
                        {
                            ColorBlend cb = new ColorBlend(3);
                            cb.Colors = new Color[]{north, centre, south};
                            cb.Positions = new float[] { 0f, .3f, 1f };
                            b.InterpolationColors = cb;

                            SmoothingMode sm = e.Graphics.SmoothingMode;
                            e.Graphics.SmoothingMode = SmoothingMode.None;
                            e.Graphics.FillPath(b, path);
                            e.Graphics.SmoothingMode = sm;
                        }
                    }
                }

            }
            
            #endregion

            #region Office_2013

            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
            {

                if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
                {
                    WinApi.FillForGlass(e.Graphics, r);
                }
                else
                {
                    using (Brush b = new SolidBrush(ColorTable.TabNormalBackground_2013))
                    {
                        e.Graphics.FillRectangle(b, r);
                    }
                }

                using (GraphicsPath path = FlatRectangle(e.Tab.Bounds))
                {
                    Color north = ColorTable.TabNorth;
                    Color centre = ColorTable.TabSouth;
                    Color south = ColorTable.TabSouth;

                    if (e.Tab.Contextual)
                    {
                        north = Color.FromArgb(40, e.Tab.Context.GlowColor);
                        centre = Color.FromArgb(20, e.Tab.Context.GlowColor);
                        south = Color.FromArgb(0, e.Tab.Context.GlowColor);

                        //Tab background
                        using (LinearGradientBrush b = new LinearGradientBrush(
                                r, north, south, 90))
                        {
                            ColorBlend cb = new ColorBlend(3);
                            cb.Colors = new Color[] { north, centre, south };
                            cb.Positions = new float[] { 0f, .3f, 1f };
                            b.InterpolationColors = cb;

                            SmoothingMode sm = e.Graphics.SmoothingMode;
                            e.Graphics.SmoothingMode = SmoothingMode.None;
                            e.Graphics.FillPath(b, path);
                            e.Graphics.SmoothingMode = sm;
                        }
                    }
                }
            }

            #endregion

            e.Graphics.SetClip(lastClip);
        }
        public override void OnRenderRibbonTabText(RibbonTabRenderEventArgs e)
        {
            StringFormat sf = new StringFormat();

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

            Rectangle 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);
            }
        }
Exemple #23
0
 /// <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)
 {
 }
        /// <summary>
        /// Draws a pressed tab
        /// </summary>
        /// <param name="e"></param>
        public void DrawTabPressed(RibbonTabRenderEventArgs e)
        {

        }
Exemple #25
0
 /// <summary>
 /// Call to draw the scroll buttons on the tab
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderTabScrollButtons(RibbonTabRenderEventArgs e)
 {
 }
 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);
     }
 }