I'm afraid that I'm experiencing a bug in Winforms/GDI+. I'm building a graphics path composed by a line and then a curve. At some zoom levels (applying a transform matrix to the graphics object) the path is wrongly drawn, see the picture:
Doing some testing I noticed that if I apply Flatten()
to the graphics path, the problem dissapears. It seems that the curves are converted to connected segments, and the problem dissapears (this is the code):
result.AddLine(sourcex, sourcey开发者_StackOverflow, sourcex, sourcey + sourceOffset);
result.AddArc(ellipseContainer, startAngle, sweepAngle);
result.Flatten(); // this line solves the issue!!
I have debugged the application and the number of points in the graphics path is 9 without apply Flatten()
, and 53 applying Flatten()
.
My question is. What do you think about drawing performance applying Flatten() to graphicsPaths? Do you think that could be affected by this change?
Thanks in advance.
If you want the line to be joined, you should draw it as a polyline using AddLines
精彩评论