private static IDisposable DrawBackGlassCheckedPercent(RenderContext context,
Rectangle rect,
Color backColor1,
Color backColor2,
VisualOrientation orientation,
GraphicsPath path,
float glassPercent,
IDisposable memento)
{
using (Clipping clip = new Clipping(context.Graphics, path))
{
MementoTriple cache;
if ((memento == null) || !(memento is MementoTriple))
{
if (memento != null)
memento.Dispose();
cache = new MementoTriple();
memento = cache;
}
else
{
cache = (MementoTriple)memento;
}
// Draw the one pixel border around the area
cache.first = DrawBackLinearRadial(rect, false,
ControlPaint.Light(backColor1),
ControlPaint.LightLight(backColor1),
ControlPaint.LightLight(backColor1),
orientation, context.Graphics,
cache.first);
// Reduce size on all but the upper edge
ModifyRectByEdges(ref rect, 1, 0, 1, 1, orientation);
// Draw the inside areas as a glass effect
cache.second = DrawBackGlassRadial(rect, backColor1, backColor2,
_glassColorTopL, _glassColorBottomL,
6f, 1.2f, orientation, context.Graphics,
glassPercent, cache.second);
// Widen back to original
ModifyRectByEdges(ref rect, -1, 0, -1, 0, orientation);
// Draw a darker area for top edge
cache.third = DrawBackDarkEdge(rect, ControlPaint.Dark(backColor1),
3, orientation, context.Graphics,
cache.third);
}
return memento;
}