我正在使用 C# Graphics 绘制心电图。我使用画线方法绘制曲线。然而线接头看起来断了。我尝试了平滑模式和 capstyle 的所有可用选项,但没有任何帮助。这是示例图 1和示例图 2
代码如下:
private void DrawCurve(Graphics g, cPoint[] data)
{
List<Point> ps = new List<Point>();
for (int i = 0; i < data.Length - 1; i++)
{
int x = data[i].x;
int y = data[i].y;
if (x > 0 && x < (Width))
{
ps.Add(new Point(x, y));
}
else if (x > Width)
{
using (Pen p = new Pen(Color.Yellow))
{
if (ps.Count > 0)
{
g.DrawLines(p, ps.ToArray());
ps.Clear();
}
} …Run Code Online (Sandbox Code Playgroud)