G
Guest
Hi,
I think I've found a bug in the System.Drawing.Graphic.DrawLines method.
The code below fills a list with a number of points and then draws these
points using DrawLines and then using DrawLine within a loop.
The DrawLines() method inserts a superious line that that is not drawn using
the DrawLine() function.
This bug was initially found in a ASP.NET application but has been
replicated in a Windows Form application.
Regards,
Dave.
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
List<System.Drawing.PointF> pointsToDraw = new List<System.Drawing.PointF>();
Pen penCyan = new Pen(Brushes.Cyan, 5);
Pen penRed = new Pen(Brushes.Red, 5);
pointsToDraw.Clear();
pointsToDraw.Add(new PointF((float)513.4, (float)311.3));
pointsToDraw.Add(new PointF((float)517.6, (float)314));
pointsToDraw.Add(new PointF((float)518.5, (float)314.6));
pointsToDraw.Add(new PointF((float)526.4, (float)319.8));
pointsToDraw.Add(new PointF((float)529.1, (float)321.5));
pointsToDraw.Add(new PointF((float)529.25, (float)321.6));
pointsToDraw.Add(new PointF((float)529.25, (float)321.85));
pointsToDraw.Add(new PointF((float)531.6, (float)329.7));
pointsToDraw.Add(new PointF((float)534, (float)337.6));
pointsToDraw.Add(new PointF((float)533.95, (float)337.85));
pointsToDraw.Add(new PointF((float)533.85, (float)338));
pointsToDraw.Add(new PointF((float)533.6, (float)338.4));
pointsToDraw.Add(new PointF((float)529.9, (float)343.75));
pointsToDraw.Add(new PointF((float)526.2, (float)349.15));
pointsToDraw.Add(new PointF((float)524.9, (float)352.55));
pointsToDraw.Add(new PointF((float)524.8, (float)353));
pointsToDraw.Add(new PointF((float)524.85, (float)353.6));
pointsToDraw.Add(new PointF((float)525, (float)355.25));
pointsToDraw.Add(new PointF((float)525.1, (float)355.95));
pointsToDraw.Add(new PointF((float)525.55, (float)364));
pointsToDraw.Add(new PointF((float)525.55, (float)364.05));
pointsToDraw.Add(new PointF((float)525.95, (float)371.55));
pointsToDraw.Add(new PointF((float)526, (float)371.8));
pointsToDraw.Add(new PointF((float)526.05, (float)372.1));
pointsToDraw.Add(new PointF((float)526.05, (float)372.25));
pointsToDraw.Add(new PointF((float)526.1, (float)372.4));
pointsToDraw.Add(new PointF((float)526.45, (float)373.2));
pointsToDraw.Add(new PointF((float)526.45, (float)373.3));
pointsToDraw.Add(new PointF((float)526.5, (float)373.45));
pointsToDraw.Add(new PointF((float)526.45, (float)373.55));
pointsToDraw.Add(new PointF((float)526.4, (float)373.6));
pointsToDraw.Add(new PointF((float)519.4, (float)381.5));
pointsToDraw.Add(new PointF((float)519.6, (float)381.3)); // <- this point
causes the problem
pointsToDraw.Add(new PointF((float)514.75, (float)387.2));
pointsToDraw.Add(new PointF((float)514.5, (float)387.55));
pointsToDraw.Add(new PointF((float)514.45, (float)387.8));
pointsToDraw.Add(new PointF((float)514.4, (float)388));
pointsToDraw.Add(new PointF((float)514.3, (float)388.25));
pointsToDraw.Add(new PointF((float)514.2, (float)388.45));
pointsToDraw.Add(new PointF((float)514.25, (float)388.6));
pointsToDraw.Add(new PointF((float)514.3, (float)388.8));
pointsToDraw.Add(new PointF((float)516.3, (float)391.35));
pointsToDraw.Add(new PointF((float)518.5, (float)394.15));
pointsToDraw.Add(new PointF((float)524.45, (float)401.8));
pointsToDraw.Add(new PointF((float)530.45, (float)409.5));
pointsToDraw.Add(new PointF((float)534.15, (float)415.45));
pointsToDraw.Add(new PointF((float)537.85, (float)421.4));
pointsToDraw.Add(new PointF((float)538.05, (float)421.8));
pointsToDraw.Add(new PointF((float)541.9, (float)431.15));
pointsToDraw.Add(new PointF((float)541.95, (float)431.6));
pointsToDraw.Add(new PointF((float)542, (float)431.9));
pointsToDraw.Add(new PointF((float)542, (float)432.3));
pointsToDraw.Add(new PointF((float)542, (float)432.65));
g.DrawLines(penCyan, pointsToDraw.ToArray());
for (int loop = 1; loop < pointsToDraw.Count; loop++)
{
g.DrawLine(penRed, pointsToDraw[loop - 1], pointsToDraw[loop]);
}
}
I think I've found a bug in the System.Drawing.Graphic.DrawLines method.
The code below fills a list with a number of points and then draws these
points using DrawLines and then using DrawLine within a loop.
The DrawLines() method inserts a superious line that that is not drawn using
the DrawLine() function.
This bug was initially found in a ASP.NET application but has been
replicated in a Windows Form application.
Regards,
Dave.
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
List<System.Drawing.PointF> pointsToDraw = new List<System.Drawing.PointF>();
Pen penCyan = new Pen(Brushes.Cyan, 5);
Pen penRed = new Pen(Brushes.Red, 5);
pointsToDraw.Clear();
pointsToDraw.Add(new PointF((float)513.4, (float)311.3));
pointsToDraw.Add(new PointF((float)517.6, (float)314));
pointsToDraw.Add(new PointF((float)518.5, (float)314.6));
pointsToDraw.Add(new PointF((float)526.4, (float)319.8));
pointsToDraw.Add(new PointF((float)529.1, (float)321.5));
pointsToDraw.Add(new PointF((float)529.25, (float)321.6));
pointsToDraw.Add(new PointF((float)529.25, (float)321.85));
pointsToDraw.Add(new PointF((float)531.6, (float)329.7));
pointsToDraw.Add(new PointF((float)534, (float)337.6));
pointsToDraw.Add(new PointF((float)533.95, (float)337.85));
pointsToDraw.Add(new PointF((float)533.85, (float)338));
pointsToDraw.Add(new PointF((float)533.6, (float)338.4));
pointsToDraw.Add(new PointF((float)529.9, (float)343.75));
pointsToDraw.Add(new PointF((float)526.2, (float)349.15));
pointsToDraw.Add(new PointF((float)524.9, (float)352.55));
pointsToDraw.Add(new PointF((float)524.8, (float)353));
pointsToDraw.Add(new PointF((float)524.85, (float)353.6));
pointsToDraw.Add(new PointF((float)525, (float)355.25));
pointsToDraw.Add(new PointF((float)525.1, (float)355.95));
pointsToDraw.Add(new PointF((float)525.55, (float)364));
pointsToDraw.Add(new PointF((float)525.55, (float)364.05));
pointsToDraw.Add(new PointF((float)525.95, (float)371.55));
pointsToDraw.Add(new PointF((float)526, (float)371.8));
pointsToDraw.Add(new PointF((float)526.05, (float)372.1));
pointsToDraw.Add(new PointF((float)526.05, (float)372.25));
pointsToDraw.Add(new PointF((float)526.1, (float)372.4));
pointsToDraw.Add(new PointF((float)526.45, (float)373.2));
pointsToDraw.Add(new PointF((float)526.45, (float)373.3));
pointsToDraw.Add(new PointF((float)526.5, (float)373.45));
pointsToDraw.Add(new PointF((float)526.45, (float)373.55));
pointsToDraw.Add(new PointF((float)526.4, (float)373.6));
pointsToDraw.Add(new PointF((float)519.4, (float)381.5));
pointsToDraw.Add(new PointF((float)519.6, (float)381.3)); // <- this point
causes the problem
pointsToDraw.Add(new PointF((float)514.75, (float)387.2));
pointsToDraw.Add(new PointF((float)514.5, (float)387.55));
pointsToDraw.Add(new PointF((float)514.45, (float)387.8));
pointsToDraw.Add(new PointF((float)514.4, (float)388));
pointsToDraw.Add(new PointF((float)514.3, (float)388.25));
pointsToDraw.Add(new PointF((float)514.2, (float)388.45));
pointsToDraw.Add(new PointF((float)514.25, (float)388.6));
pointsToDraw.Add(new PointF((float)514.3, (float)388.8));
pointsToDraw.Add(new PointF((float)516.3, (float)391.35));
pointsToDraw.Add(new PointF((float)518.5, (float)394.15));
pointsToDraw.Add(new PointF((float)524.45, (float)401.8));
pointsToDraw.Add(new PointF((float)530.45, (float)409.5));
pointsToDraw.Add(new PointF((float)534.15, (float)415.45));
pointsToDraw.Add(new PointF((float)537.85, (float)421.4));
pointsToDraw.Add(new PointF((float)538.05, (float)421.8));
pointsToDraw.Add(new PointF((float)541.9, (float)431.15));
pointsToDraw.Add(new PointF((float)541.95, (float)431.6));
pointsToDraw.Add(new PointF((float)542, (float)431.9));
pointsToDraw.Add(new PointF((float)542, (float)432.3));
pointsToDraw.Add(new PointF((float)542, (float)432.65));
g.DrawLines(penCyan, pointsToDraw.ToArray());
for (int loop = 1; loop < pointsToDraw.Count; loop++)
{
g.DrawLine(penRed, pointsToDraw[loop - 1], pointsToDraw[loop]);
}
}