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

前端 未结 3 1322
谎友^
谎友^ 2021-01-14 08:11

See the image. I would like the middle line to be a crispy 1 pixel line. You can copy and paste the sample markup into kaxaml .

alt text http://img832.imageshack.us

相关标签:
3条回答
  • 2021-01-14 08:49

    I found the solution at: http://msdn.microsoft.com/en-us/library/system.windows.media.renderoptions.setedgemode.aspx

    <Image Stretch="None" RenderOptions.EdgeMode="Aliased">
    RenderOptions.SetEdgeMode(this, EdgeMode.Aliased);
    
    0 讨论(0)
  • 2021-01-14 09:09

    I saw a similar issue with the Border control, although @phi your solution worked in most cases I also had to add the following to get it to completely work:

    SnapsToDevicePixels="True"
    
    0 讨论(0)
  • 2021-01-14 09:12

    Change the middle line to:

    <LineGeometry StartPoint="0,6" EndPoint="50,6"/>
    

    You can get a crisp line on a pixel boundary by placing the line on a whole numbered unit.

    0 讨论(0)
提交回复
热议问题