wpf - How to draw none fuzzy/blurry line in DrawingImage/DrawingContext? -


See the picture I think the middle line should be a crisp 1 pixel line. You can copy and paste sample markup.

  & lt; Page xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml" & gt; & Lt; Image Snap Tudwise Pixel = "True" Stretch = "None" & gt; & Lt; Image.Source & gt; & Lt; DrawingImage & gt; & Lt; DrawingImage.Drawing & gt; & Lt; DrawingGroup & gt; & Lt; GeometryDrawing & gt; & Lt; GeometryDrawing.Pen & gt; & Lt; Pen brush = "red" thickness = "1" /> & Lt; /GeometryDrawing.Pen> & Lt; GeometryDrawing.Gemometry & gt; & Lt; LineGeometry Start Page = "0,0" Endpoint = "50,0" /> & Lt; /GeometryDrawing.Geometry> & Lt; / GeometryDrawing & gt; & Lt; GeometryDrawing & gt; & Lt; GeometryDrawing.Pen & gt; & Lt; Pen brush = "black" thickness = "1" /> & Lt; /GeometryDrawing.Pen> & Lt; GeometryDrawing.Gemometry & gt; & Lt; LineGeometry Start Page = "0,5.860" Endosystem = "50,5.860" /> & Lt; /GeometryDrawing.Geometry> & Lt; / GeometryDrawing & gt; & Lt; GeometryDrawing & gt; & Lt; GeometryDrawing.Pen & gt; & Lt; Pen brush = "black" thickness = "1" /> & Lt; /GeometryDrawing.Pen> & Lt; GeometryDrawing.Gemometry & gt; & Lt; LineGeometry Start Page = "0,12" Endos = "50,12" /> & Lt; /GeometryDrawing.Geometry> & Lt; / GeometryDrawing & gt; & Lt; / DrawingGroup & gt; & Lt; /DrawingImage.Drawing> & Lt; / DrawingImage & gt; & Lt; /Image.Source> & Lt; / Image & gt; & Lt; / Page & gt;  

I got the solution:

< Pre> & lt; Image Stretch = "None" Render Optoptions. Edzmoda = "Alated" & gt; RenderOptions.SetEdgeMode (this, EdgeMode.Aliased);

Comments