ComponentFactory.Krypton.Toolkit.RenderStandard.DrawRibbonTabTracking2007 C# (CSharp) Method

DrawRibbonTabTracking2007() protected method

Internal rendering method.
protected DrawRibbonTabTracking2007 ( PaletteRibbonShape shape, RenderContext context, Rectangle rect, PaletteState state, IPaletteRibbonBack palette, VisualOrientation orientation, IDisposable memento ) : IDisposable
shape PaletteRibbonShape
context RenderContext
rect System.Drawing.Rectangle
state PaletteState
palette IPaletteRibbonBack
orientation VisualOrientation
memento IDisposable
return IDisposable
        protected virtual IDisposable DrawRibbonTabTracking2007(PaletteRibbonShape shape,
                                                                RenderContext context, 
                                                                Rectangle rect,
                                                                PaletteState state,
                                                                IPaletteRibbonBack palette,
                                                                VisualOrientation orientation,
                                                                IDisposable memento)
        {
            if ((rect.Width > 0) && (rect.Height > 0))
            {
                Color c1 = palette.GetRibbonBackColor1(state);
                Color c2 = palette.GetRibbonBackColor2(state);

                bool generate = true;
                MementoRibbonTabTracking2007 cache;

                // Access a cache instance and decide if cache resources need generating
                if ((memento == null) || !(memento is MementoRibbonTabTracking2007))
                {
                    if (memento != null)
                        memento.Dispose();

                    cache = new MementoRibbonTabTracking2007(rect, c1, c2, orientation);
                    memento = cache;
                }
                else
                {
                    cache = (MementoRibbonTabTracking2007)memento;
                    generate = !cache.UseCachedValues(rect, c1, c2, orientation);
                }

                // Do we need to generate the contents of the cache?
                if (generate)
                {
                    // Dispose of existing values
                    cache.Dispose();

                    switch (orientation)
                    {
                        case VisualOrientation.Top:
                            DrawRibbonTabTrackingTop2007(rect, c1, c2, cache);
                            break;
                        case VisualOrientation.Left:
                            DrawRibbonTabTrackingLeft2007(rect, c1, c2, cache);
                            break;
                        case VisualOrientation.Right:
                            DrawRibbonTabTrackingRight2007(rect, c1, c2, cache);
                            break;
                        case VisualOrientation.Bottom:
                            DrawRibbonTabTrackingBottom2007(rect, c1, c2, cache);
                            break;
                    }
                }

                // Draw the left and right sides with light version of tracking color
                context.Graphics.FillRectangle(cache.half1LeftBrush, cache.half1Rect);
                context.Graphics.FillRectangle(cache.half1RightBrush, cache.half1Rect);

                // Draw over with glassy effect
                context.Graphics.FillRectangle(cache.half1LightBrush, cache.half1Rect);

                //// Use a solid fill for the bottom half
                context.Graphics.FillRectangle(cache.half2Brush, cache.half2Rect);

                // Cannot draw a path that contains a zero sized element
                if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
                {
                    // Draw twice to get a deeper color effect, once is to pale
                    context.Graphics.FillRectangle(cache.ellipseBrush, cache.half2RectF);
                    context.Graphics.FillRectangle(cache.ellipseBrush, cache.half2RectF);
                }

                // Draw the actual border
                using (AntiAlias aa = new AntiAlias(context.Graphics))
                    context.Graphics.DrawPath(cache.outsidePen, cache.outsidePath);

                switch (orientation)
                {
                    case VisualOrientation.Top:
                        DrawRibbonTabTrackingTopDraw2007(rect, cache, context.Graphics);
                        break;
                    case VisualOrientation.Left:
                        DrawRibbonTabTrackingLeftDraw2007(rect, cache, context.Graphics);
                        break;
                    case VisualOrientation.Right:
                        DrawRibbonTabTrackingRightDraw2007(rect, cache, context.Graphics);
                        break;
                    case VisualOrientation.Bottom:
                        DrawRibbonTabTrackingBottomDraw2007(rect, cache, context.Graphics);
                        break;
                }

                context.Graphics.DrawPath(cache.topPen, cache.topPath);
            }

            return memento;
        }
RenderStandard