I am seeing the weirdest bug with the following code.
I have a PathGeometry
to which I added a PathFigure
so that I can add LineSegment
s to it.
This is what I do:
_pathGeometry.Figures.Add(_pathFigure);
_pathFigure.StartPoint = new Point(4, 0);
LineSegment lineSegment1 = new LineSegment(new Point(4, -10), true);
LineSegment lineSegment2 = new LineSegment(new Point(4, 0), true);
_pathFigure.Segments.Add(lineSegment1);
_pathFigure.Segments.Add(lineSegment2);
I then draw it:
using (DrawingContext drawingContext = RenderOpen())
drawingContext.DrawGeometry(null, _pen, _pathGeometry);
What I should see:
WPF should draw a vertical line that goes from 0 to -10 and back to 0. The last part (back to 0) cannot be seen because it's drawn on the same x pixel. But the last part causes the following:
What I see:
WPF draws a line that goes from 0 to -15. It makes no sense to me. This 5 pixel difference happens whenever I draw a vertical line on top of another vertical line as in the previous example.
Please someone tell me I made a mistake and this is not a WPF bug.