tags:

views:

485

answers:

3
+3  A: 

I have noticed this as well when using gradient brushes. The only effective workaround I have is to always create the gradient brush rectangle 1 pixel bigger on all edges than the area that is going to be painted with it. That protects you against the issue on all four edges. The downside is that the colors used at the edges are a fraction off those you specify, but this is better than the drawing artifact problem!

Phil Wright
For my purposes, that works and now the artifacts are finally gone \o/
Michael Stum
+3  A: 

You can use the nice Inflate(int i) method on a rectangle to get the bigger version.

Nick
I did not even know that function. neat :)
Michael Stum
+1  A: 

At least with WPF you could try to use GradientStops to get 100% correct colors right at the edges, even when overpainting.

David Schmitt