Reputation: 653
In a paint event I did:
List<Point> drawPoints = GetDrawPoints();
if (drawPoints.Count > 1)
{
foreach (Point p in drawPoints)
{
e.Graphics.DrawLine(pen, p.X - 2, p.Y - 2, 4, 4);
}
}
But instead of drawing lines between the subsequential points, it's drawing two lines from same place to each point.
I want to connect all point with a single line.
Upvotes: 3
Views: 2509
Reputation: 2085
You answered your own question in a way. To draw a line you need at the very least two points. But you keep drawing your news lines between the sames locations. (your variable point and a point located in (4;4)). You need to keep updating two points in your foreach and print them properly.
Better yet, use the DrawLines function, and give your list of points away. with something like :
e.Graphics.DrawLines(pen, drawPoints.ToArray());
Upvotes: 2