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

DrawGridErrorGlyph() public method

Draw a grid error glyph.
public DrawGridErrorGlyph ( RenderContext context, Rectangle cellRect, PaletteState state, bool rtl ) : Rectangle
context RenderContext Render context.
cellRect System.Drawing.Rectangle Available drawing rectangle space.
state PaletteState State associated with rendering.
rtl bool Should be drawn from right to left.
return System.Drawing.Rectangle
        public override Rectangle DrawGridErrorGlyph(RenderContext context,
                                                     Rectangle cellRect,
                                                     PaletteState state,
                                                     bool rtl)
        {
            Debug.Assert(context != null);

            // Get the appropriate each to draw
            Image errorImage = _gridErrorIcon.Images[0];

            // Is there enough room to draw the image?
            if ((errorImage.Width < cellRect.Width) && (errorImage.Height < cellRect.Height))
            {
                // Find the drawing location of the image
                int y = cellRect.Top + (cellRect.Height - errorImage.Height) / 2;
                int x = (rtl ? cellRect.Left : cellRect.Right - errorImage.Width);

                if (state == PaletteState.Disabled)
                    ControlPaint.DrawImageDisabled(context.Graphics, errorImage, x, y, Color.Empty);
                else
                    context.Graphics.DrawImage(errorImage, x, y);

                // Reduce the cell rect by that used up
                cellRect.Width -= errorImage.Width;

                // With rtl we need to move across to the right
                if (rtl)
                    cellRect.X += errorImage.Width;
            }

            return cellRect;
        }
RenderStandard