public override Rectangle DrawGridRowGlyph(RenderContext context,
GridRowGlyph rowGlyph,
Rectangle cellRect,
IPaletteContent paletteContent,
PaletteState state,
bool rtl)
{
Debug.Assert(context != null);
Debug.Assert(paletteContent != null);
// Get the appropriate each to draw
Image rowImage = null;
switch (rowGlyph)
{
case GridRowGlyph.ArrowStar:
rowImage = _gridRowIndicators.Images[rtl ? 4 : 0];
break;
case GridRowGlyph.Star:
rowImage = _gridRowIndicators.Images[rtl ? 5 : 1];
break;
case GridRowGlyph.Pencil:
rowImage = _gridRowIndicators.Images[rtl ? 6 : 2];
break;
case GridRowGlyph.Arrow:
rowImage = _gridRowIndicators.Images[rtl ? 7 : 3];
break;
}
// Is there enough room to draw the image?
if ((rowImage != null) &&
(rowImage.Width < cellRect.Width) &&
(rowImage.Height < cellRect.Height))
{
// Find the drawing location of the image
int y = cellRect.Top + (cellRect.Height - rowImage.Height) / 2;
int x = (rtl ? cellRect.Right - rowImage.Width : cellRect.Left);
// Grab the foreground color to use for the image
Color imageColor = paletteContent.GetContentShortTextColor1(state);
// Draw the image with remapping the image color to the foreground color
using (ImageAttributes attribs = new ImageAttributes())
{
ColorMap cm = new ColorMap();
cm.OldColor = Color.Black;
cm.NewColor = CommonHelper.MergeColors(imageColor, 0.75f, Color.Transparent, 0.25f);
attribs.SetRemapTable(new ColorMap[] { cm }, ColorAdjustType.Bitmap);
context.Graphics.DrawImage(rowImage,
new Rectangle(x, y, rowImage.Width, rowImage.Height),
0, 0, rowImage.Width, rowImage.Height,
GraphicsUnit.Pixel, attribs);
}
// Reduce the cell rect by that used up
cellRect.Width -= rowImage.Width;
// With NOT rtl we need to move across to the right
if (!rtl)
cellRect.X += rowImage.Width;
}
return cellRect;
}