public override void DrawTrackGlyph(RenderContext context,
PaletteState state,
IPaletteElementColor elementPalette,
Rectangle drawRect,
Orientation orientation,
bool volumeControl)
{
// The position indicator leavesa gap at the left/right ends for horizontal and top/bottom for vertical
// so we do not draw that last pixel so that when the indicator is at the end the track does not stick out
if (orientation == Orientation.Horizontal)
drawRect.Inflate(-1, 0);
else
drawRect.Inflate(0, -1);
using (Pen border1Pen = new Pen(elementPalette.GetElementColor1(state)),
border2Pen = new Pen(elementPalette.GetElementColor2(state)))
{
using (SolidBrush insideBrush = new SolidBrush(elementPalette.GetElementColor3(state)))
{
if (!volumeControl)
{
context.Graphics.FillRectangle(insideBrush, drawRect.X + 1, drawRect.Y + 1, drawRect.Width - 2, drawRect.Height - 2);
context.Graphics.DrawLines(border1Pen, new Point[]{ new Point(drawRect.Right - 1, drawRect.Y),
new Point(drawRect.X, drawRect.Y),
new Point(drawRect.X, drawRect.Bottom - 1)});
context.Graphics.DrawLines(border2Pen, new Point[]{ new Point(drawRect.Right - 1, drawRect.Y + 1),
new Point(drawRect.Right - 1, drawRect.Bottom - 1),
new Point(drawRect.X + 1, drawRect.Bottom - 1)});
}
else
{
if (orientation == Orientation.Horizontal)
{
using (AntiAlias aa = new AntiAlias(context.Graphics))
{
context.Graphics.FillPolygon(insideBrush, new Point[]{ new Point(drawRect.X, drawRect.Bottom - 2),
new Point(drawRect.Right - 1, drawRect.Y),
new Point(drawRect.Right - 1, drawRect.Bottom - 1),
new Point(drawRect.X, drawRect.Bottom - 1),
new Point(drawRect.X, drawRect.Bottom - 2)});
context.Graphics.DrawLines(border1Pen, new Point[]{ new Point(drawRect.Right - 1, drawRect.Y),
new Point(drawRect.Right - 1, drawRect.Bottom - 1),
new Point(drawRect.X, drawRect.Bottom - 1),
new Point(drawRect.X, drawRect.Bottom - 2),
new Point(drawRect.Right - 1, drawRect.Y)});
}
}
else
{
using (AntiAlias aa = new AntiAlias(context.Graphics))
{
context.Graphics.FillPolygon(insideBrush, new Point[]{ new Point(drawRect.X + 1, drawRect.Bottom - 1),
new Point(drawRect.Right - 1, drawRect.Y + 1),
new Point(drawRect.X, drawRect.Y + 1),
new Point(drawRect.X, drawRect.Bottom - 1),
new Point(drawRect.X + 1, drawRect.Bottom - 1)});
context.Graphics.DrawLines(border1Pen, new Point[]{ new Point(drawRect.Right - 1, drawRect.Y + 1),
new Point(drawRect.X, drawRect.Y + 1),
new Point(drawRect.X, drawRect.Bottom - 1),
new Point(drawRect.X + 1, drawRect.Bottom - 1),
new Point(drawRect.Right - 1, drawRect.Y + 1)});
}
}
}
}
}
}