我不明白为什么阴影路径在箭帽附近有荆棘。
参考我的截图。
using (GraphicsPath _Path = new GraphicsPath())
{
Point[] _Points = new Point[] {
new Point { X = mouseDownX, Y = mouseDownY },
new Point { X = lineEndX - 51, Y = mouseDownY },
new Point { X = lineEndX - 51, Y = mouseDownY - 20 },
new Point { X = lineEndX, Y = mouseDownY + 5},
new Point { X = lineEndX -51, Y = mouseDownY + 25},
new Point { X = lineEndX -51, Y = mouseDownY +10 },
new Point { X = mouseDownX, Y = mouseDownY +10 }};
_Path.AddPolygon(_Points);
using (PathGradientBrush _Brush = new PathGradientBrush(_Path))
{
_Brush.WrapMode = WrapMode.Clamp;
ColorBlend _ColorBlend = new ColorBlend(3);
_ColorBlend.Colors = new Color[]{Color.Transparent,
Color.FromArgb(180, Color.DimGray),
Color.FromArgb(180, Color.DimGray)};
_ColorBlend.Positions = new float[] { 0f, 0.1f, 1f};
_Brush.InterpolationColors = _ColorBlend;
//myGraphics.Clip = new Region(_Path);
myGraphics.FillPath(_Brush,_Path);
//myGraphics.ResetClip();
}
Matrix _Matrix = new Matrix();
int _ShadowDistance = -40;
_Matrix.Translate(_ShadowDistance, _ShadowDistance);
_Path.Transform(_Matrix);
myGraphics.FillPath(Brushes.Red, _Path);
}