Silverlight Path is blurry - How to snap to pixels?

好久不见. 提交于 2019-11-30 15:13:52

问题


I have a Canvas onto which I draw a Path:

<Path Data="M 380 110 v -10 l 100 -100"
      Stroke="#C0C0C2" StrokeThickness="1" UseLayoutRounding="True" />

Even though the StrokeThickness is set to 1, the vertical part of the path is drawn across 2 pixels and in a lighter color.

I know that WPF has the SnapsToDevicePixels property that would fix it, and I read that in Silverlight there is a UseLayoutRounding property that you can use in some cases to have the same effect, however it does not seem to apply to Path.

Is there anything I can do to get that line drawn properly?


回答1:


There is a pixel snapper class over at MSDN on Dave Relyea's Silverlight Blog. That is what I have used in the past for Silverlight pixel snapping.



来源:https://stackoverflow.com/questions/6182320/silverlight-path-is-blurry-how-to-snap-to-pixels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!