How to disable anti-aliasing in WPF forms?

I draw a rectangle using:

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

but anti-aliasing applies to it. Is there any way to disable this? I want it to be crisp and clear.

+16
c # wpf graphics drawing
Apr 07 2018-11-11T00:
source share
3 answers

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

 <Rectangle Width="300" Height="100" Stroke="Blue" StrokeThickness="6" RenderOptions.EdgeMode="Aliased"/> 
+20
Apr 24 '12 at 18:22
source share
+4
Apr 7 2018-11-11T00:
source share

Turning off anti-aliasing is not what you are looking for because you do not have a radius plotted on the corners.

If you use .Net 4 or higher, enable UseLayoutRounding http://msdn.microsoft.com/en-us/library/system.windows.uielement.uselayoutrounding(v=vs.95).aspx

+2
Jan 23 '13 at 15:12
source share



All Articles