ComponentFactory.Krypton.Toolkit.ViewDrawWeekNumbers.RenderBefore C# (CSharp) Method

RenderBefore() public method

Perform rendering before child elements are rendered.
public RenderBefore ( RenderContext context ) : void
context RenderContext Rendering context.
return void
        public override void RenderBefore(RenderContext context)
        {
            Debug.Assert(context != null);

            // Do not draw week numbers in bold or focused
            _calendar.SetFocusOverride(false);
            _calendar.SetBoldedOverride(false);

            // Layout each week number
            Rectangle drawRectWeek = new Rectangle(ClientLocation.X, ClientLocation.Y, _months.SizeDay.Width, _months.SizeDays.Height);
            DateTime weekDate = _weekDay;
            DateTime displayDate = _firstDay;
            for (int j = 0; j < WEEKS; j++)
            {
                // Should we draw a week number for a week starting on this date
                DateTime weekNumberDate = weekDate;
                if (DisplayWeekNumber(displayDate, ref weekNumberDate))
                {
                    // Define text to be drawn
                    _drawText = GetWeekNumber(weekNumberDate).ToString();

                    PaletteState paletteState = (Enabled ? PaletteState.Normal : PaletteState.Disabled);
                    IPaletteTriple paletteTriple = (Enabled ? _calendar.StateNormal.Day : _calendar.StateDisabled.Day);

                    // Do we need to draw the background?
                    if (paletteTriple.PaletteBack.GetBackDraw(paletteState) == InheritBool.True)
                    {
                        using (GraphicsPath path = context.Renderer.RenderStandardBorder.GetBackPath(context, drawRectWeek, paletteTriple.PaletteBorder,
                                                                                                     VisualOrientation.Top, paletteState))
                        {
                            context.Renderer.RenderStandardBack.DrawBack(context, drawRectWeek, path, paletteTriple.PaletteBack, VisualOrientation.Top, paletteState, null);
                        }
                    }

                    // Do we need to draw the border?
                    if (paletteTriple.PaletteBorder.GetBorderDraw(paletteState) == InheritBool.True)
                    {
                        context.Renderer.RenderStandardBorder.DrawBorder(context, drawRectWeek, paletteTriple.PaletteBorder, VisualOrientation.Top, paletteState);
                    }

                    // Do we need to draw the content?
                    if (paletteTriple.PaletteContent.GetContentDraw(paletteState) == InheritBool.True)
                    {
                        context.Renderer.RenderStandardContent.DrawContent(context, drawRectWeek, paletteTriple.PaletteContent, _dayMementos[j],
                                                                           VisualOrientation.Top, paletteState, false,false, true);
                    }
                }

                // Move to next week
                weekDate += TIMESPAN_1WEEK;
                displayDate += TIMESPAN_1WEEK;
                drawRectWeek.Y += _months.SizeDays.Height;
            }
        }