开发者

How to turn off the anti-aliasing in WPF shapes?

I draw a rectangle using:

<Rectangle Width="300" Height="100" Stroke="Blue" StrokeThickness="6"> </Rectangle>

but there i开发者_开发问答s anti-aliasing applied to it. Is there a way to turn this off? I want it to be sharp and clear.


A little late but RenderOptions.EdgeMode="Aliased" does the trick

<Rectangle Width="300"
           Height="100"
           Stroke="Blue"
           StrokeThickness="6"
           RenderOptions.EdgeMode="Aliased"/>


Check out SnapToDevicePixels: http://msdn.microsoft.com/en-us/library/aa970908.aspx


Turning off anti-aliasing is not what you are looking for, seeing as you dont have a radius applied to the corners.

If you are using .Net 4 or above, turn on UseLayoutRounding http://msdn.microsoft.com/en-us/library/system.windows.uielement.uselayoutrounding(v=vs.95).aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜