4
votes

It seems that many people are trying to turn OFF anti-aliasing in WPF, but I seem to have the opposite problem. I am drawing shapes in WPF, and the edges are all aliased and ugly. The worst part is that when I use a ScaleTransform to zoom out such that a shape is less than one pixel tall/wide, it disappears entirely. How can I make them smooth and pretty?

Currently, I am drawing Rectangles and Ellipses and placing them in grids and StackPanels.

After a lot of googling, I found out how to get my images to anti-alias by using the following line in my window's constructor: RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.Fant);

However, this only affects my Images and not my Shapes.

2

2 Answers

0
votes

You can set the EdgeMode the same way you set BitmapScalingMode

 RenderOptions.SetEdgeMode(this, EdgeMode.Unspecified);

But Anti-Aliasing is set as default so you should not need to change it, but give it a go :)

Also setting SnapsToDevicePixels = true; on your window may help with the shapes.

0
votes

I have what I think is the same problem. Setting SnapsToDevicePixels to false works for me:

<Ellipse SnapsToDevicePixels="False" />