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);
}
}
}
}