问题
We have a path defined which we would like to render in several hundred different positions during the OnRender override. We know about the PushTransform method on the DC, but that seems to require a new TranslateTransform instance for each render, which means we end up with hundreds of TranslateTransform as well. That just doesn't seem efficient.
We've also tried a single TranslateTransform, then just changing it's X and Y locations with each render, but since WPF actually caches the drawing instructions and not the actual drawing, when it's finally time to render, they all render in the same location because they are sharing the same TranslateTransform using its last-set offsets.
So what's the best way to achieve this?
来源:https://stackoverflow.com/questions/13911653/how-can-you-render-a-path-in-several-locations