在 C# 中以编程方式绘制锥形线

Drawing tapered lines programatically in c#

是否可以通过代码用c#绘制弯曲的锥形线?

我会画这样的曲线:

var g = panel1.CreateGraphics();
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
var p = new Pen(Color.Black);            
var sb = new SolidBrush(Color.Red);            
PointF[] points = new PointF[] {
    new PointF(1,0),
    new PointF(100,0),
    new PointF(200,100),
    new PointF(400,0),
};
g.DrawBeziers(p,points);

但是这样我就不能设置不同的宽度了。

这就是我想要实现的

好的,一旦我知道我必须做什么就很容易了:

绘制 2 条线并填充 space 之间:

var g = panel1.CreateGraphics();
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

PointF[] points1 = new PointF[] {
    new PointF(0,0),
    new PointF(100,150),
    new PointF(500,0),
    //new PointF(400,0),
};
PointF[] points2 = new PointF[] {
    new PointF(0,0),
    new PointF(100,160),
    new PointF(500,0),
    //new PointF(400,0),
};

panelPath = new GraphicsPath();
panelPath.AddCurve(points1);
panelPath.AddCurve(points2);
g.FillPath(Brushes.Black, panelPath);