首页 > 解决方案 > 在箭头线下绘制更好的阴影

问题描述

我现有的代码在箭头线下绘制了一个固定的“阴影”颜色。但在我看来,这很紧迫。我需要一个更好的真实阴影,带位移(水平和垂直),不透明度和模糊自定义参数。如何在 C# 中实现这种漂亮的阴影效果?

using (GraphicsPath _Path = new GraphicsPath())
{
    _Path.AddLine(mouseDownX, mouseDownY, mouseUpdX, mouseUpY);                           
    // Draw the shadow.
    mygraphics.TranslateTransform(3, 3); //displacement
    using (Pen _Pen = new Pen(Color.FromArgb(30, 0, 0, 0), hPen.Width)) 
    {
         _Pen.CustomStartCap = adjustableArrowCap_0;
         mygraphics.DrawPath(_Pen, _Path);
    }
    mygraphics.ResetTransform();
}
mygraphics.DrawLine(hPen, mouseDownX, mouseDownY, mouseUpdX, mouseUpY);

我附上一张图片来展示更好的阴影意味着什么。 在此处输入图像描述

标签: c#imageshadow

解决方案


推荐阅读