I want to add shadow on line in different angle of the line
TopLeft,
TopCenter,
TopRight,
MiddleLeft,
MiddleCenter,
MiddleRight,
BottomLeft,
BottomCenter,
BottomRight
How can i do that ?
What I have tried:
GraphicsPath path = new GraphicsPath();
path.AddLine(10, 200, 200, 200);
using (Graphics G = this.CreateGraphics())
{
var myPen = new Pen(Color.SkyBlue, 50);
G.DrawLine(myPen, new Point(10, 200), new Point(200, 200));
drawShadow(G, Color.Green, path, 25);
}
void drawShadow(Graphics G, Color c, GraphicsPath GP, int d)
{
Color[] colors = getColorVector(c, this.BackColor, d).ToArray();
for (int i = 0; i < d; i++)
{
G.TranslateTransform(0, 1);
using (Pen pen = new Pen(colors[i], 1.75f))
G.DrawPath(pen, GP);
}
G.ResetTransform();
}
List<Color> getColorVector(Color fc, Color bc, int depth)
{
List<Color> cv = new List<Color>();
float dRed = 1f * (bc.R - fc.R) / depth;
float dGreen = 1f * (bc.G - fc.G) / depth;
float dBlue = 1f * (bc.B - fc.B) / depth;
for (int d = 1; d <= depth; d++)
cv.Add(Color.FromArgb(255, (int)(fc.R + dRed * d),
(int)(fc.G + dGreen * d), (int)(fc.B + dBlue * d)));
return cv;
}