ComponentFactory.Krypton.Ribbon.DesignTimeDraw.DrawFlapArea C# (CSharp) Method

DrawFlapArea() public static method

Draw a design area with a flap on the left hand edge.
public static DrawFlapArea ( KryptonRibbon ribbon, RenderContext context, Rectangle clientRect, PaletteState state ) : void
ribbon KryptonRibbon Reference to owning ribbon control.
context ComponentFactory.Krypton.Toolkit.RenderContext Rendering context.
clientRect System.Drawing.Rectangle Client rectangle of the source view.
state PaletteState State of element.
return void
        public static void DrawFlapArea(KryptonRibbon ribbon,
                                        RenderContext context,
                                        Rectangle clientRect,
                                        PaletteState state)
        {
            Color c;

            if (state == PaletteState.Normal)
                c = ControlPaint.Dark(ribbon.StateCommon.RibbonGeneral.GetRibbonGroupSeparatorDark(PaletteState.Normal));
            else
                c = ribbon.StateCommon.RibbonGroupButton.Back.GetBackColor1(PaletteState.Tracking);

            // Draw border around entire area
            Rectangle drawRect = clientRect;
            drawRect.Width -= DESIGN_SEP_WIDTH;
            drawRect.Height--;
            drawRect.X++;
            using (Pen darkPen = new Pen(c))
                context.Graphics.DrawRectangle(darkPen, drawRect);

            // Draw the flap in the dark color
            drawRect.Width = DESIGN_FLAP_WIDTH - 2;
            using (SolidBrush darkBrush = new SolidBrush(c))
                context.Graphics.FillRectangle(darkBrush, drawRect);
        }

Usage Example

コード例 #1
0
        /// <summary>
        /// Perform rendering before child elements are rendered.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        public override void RenderBefore(RenderContext context)
        {
            // At design time we draw the selection flap
            if (_ribbon.InDesignHelperMode)
            {
                DesignTimeDraw.DrawFlapArea(_ribbon, context, ClientRectangle, State);
            }

            // Let base class draw contained items
            base.RenderBefore(context);
        }