public override void RenderAfter(RenderContext context)
{
Debug.Assert(context != null);
// Validate incoming reference
if (context == null) throw new ArgumentNullException("context");
// If not in normal state, then need to adorn display
Color outside = Color.Empty;
Color inside = Color.Empty;
// Is this element selected?
bool selected = (_colorColumns.SelectedColor != null) && (_colorColumns.SelectedColor.Equals(_color));
switch (ElementState)
{
case PaletteState.Tracking:
if (_enabled)
{
outside = _provider.ProviderStateChecked.ItemImage.Border.GetBorderColor1(PaletteState.CheckedNormal);
inside = _provider.ProviderStateChecked.ItemImage.Back.GetBackColor1(PaletteState.CheckedNormal);
}
else
{
outside = _provider.ProviderStateHighlight.ItemHighlight.Border.GetBorderColor1(PaletteState.Disabled);
inside = _provider.ProviderStateHighlight.ItemHighlight.Back.GetBackColor1(PaletteState.Disabled);
}
break;
case PaletteState.Pressed:
case PaletteState.Normal:
if (selected || (ElementState == PaletteState.Pressed))
{
outside = _provider.ProviderStateChecked.ItemImage.Border.GetBorderColor1(PaletteState.CheckedNormal);
inside = _provider.ProviderStateChecked.ItemImage.Back.GetBackColor1(PaletteState.CheckedNormal);
}
break;
}
if (!outside.IsEmpty && !inside.IsEmpty)
{
// Draw the outside and inside areas of the block
using (Pen outsidePen = new Pen(outside),
insidePen = new Pen(inside))
{
context.Graphics.DrawRectangle(outsidePen, ClientLocation.X, ClientLocation.Y, ClientWidth - 1, ClientHeight - 1);
context.Graphics.DrawRectangle(insidePen, ClientLocation.X + 1, ClientLocation.Y + 1, ClientWidth - 3, ClientHeight - 3);
}
}
}