private void DrawBackOneNote(RenderContext context,
Rectangle gradientRect,
Color backColor1,
Color backColor2,
PaletteColorStyle backColorStyle,
float backColorAngle,
VisualOrientation orientation,
GraphicsPath path)
{
// Draw entire background in first color
using (Brush backBrush = CreateColorBrush(gradientRect,
backColor1,
backColor1,
backColorStyle,
backColorAngle,
orientation))
{
context.Graphics.FillPath(backBrush, path);
}
// Make a copy of the original path, so we can change it
GraphicsPath insetPath = (GraphicsPath)path.Clone();
// Offset by 1.5 pixels so the background shows around two of
// the edges of the background we are about to draw
switch (orientation)
{
case VisualOrientation.Top:
insetPath.Transform(new Matrix(1, 0, 0, 1, 1.5f, 1.5f));
break;
case VisualOrientation.Bottom:
case VisualOrientation.Left:
insetPath.Transform(new Matrix(1, 0, 0, 1, 1.5f, -1.5f));
break;
case VisualOrientation.Right:
insetPath.Transform(new Matrix(1, 0, 0, 1, -1.5f, 1.5f));
break;
}
using (Clipping clip = new Clipping(context.Graphics, path))
{
// Draw the second color as the offset background
using (Brush backBrush = CreateColorBrush(gradientRect,
backColor2,
backColor2,
backColorStyle,
backColorAngle,
orientation))
{
context.Graphics.FillPath(backBrush, insetPath);
}
}
// Dispose of created resources
insetPath.Dispose();
}