WPF: Same line drawn different?
- by stefan.at.wpf
Hello,
I have a canvas and in it I'm drawing some lines:
for (int i = 1; i >= 100; i++)
{
// Line
LineGeometry line = new LineGeometry();
line.StartPoint = new Point(i * 100, 0);
line.EndPoint = new Point(i * 100, 100 * 100);
// Path
Path myPath = new Path();
myPath.Stroke = Brushes.Black;
myPath.StrokeThickness = 1;
// Add to canvas
myPath.Data = line;
canvas1.Children.Add(myPath);
}
Well, nothing special, but it makes problems - the lines are drawn different! The canvas is inside a scrollviewer, the following image shows different positions of the canvas, however the lines should look the same? Hell, how is this possible? The code above is the only code I've written by hand and it's the only content in the canvas. Anyone knows why this happens and how to prevent this? Thank you very much!
Screenshot: http://www.imagebanana.com/view/c01nrd6i/lines.png