ComponentFactory.Krypton.Ribbon.ViewDrawRibbonGroupImageBase.RenderBefore C# (CSharp) Method

RenderBefore() public method

Perform rendering before child elements are rendered.
public RenderBefore ( RenderContext context ) : void
context ComponentFactory.Krypton.Toolkit.RenderContext Rendering context.
return void
        public override void RenderBefore(RenderContext context)
        {
            if (DrawImage != null)
            {
                if (Enabled)
                    context.Graphics.DrawImage(DrawImage, ClientRectangle);
                else
                {
                    // Have to rescale the image when drawing, so need to use own
                    // mechanism for the converting of the image to a disabled one
                    using (ImageAttributes attribs = new ImageAttributes())
                    {
                        // Use attributes to wash out the color to look disabled
                        attribs.SetColorMatrix(CommonHelper.MatrixDisabled);

                        context.Graphics.DrawImage(DrawImage, ClientRectangle,
                                                   0, 0, DrawImage.Width, DrawImage.Height,
                                                   GraphicsUnit.Pixel, attribs);
                    }
                }
            }
        }