Silverlight 路径模糊 - 如何对齐像素? [英] Silverlight Path is blurry - How to snap to pixels?
问题描述
我有一个 Canvas
,我在上面画了一个 Path
:
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" />
即使 StrokeThickness
设置为 1,路径的垂直部分也会以较浅的颜色绘制 2 个像素.
Even though the StrokeThickness
is set to 1, the vertical part of the path is drawn across 2 pixels and in a lighter color.
我知道 WPF 有可以修复它的 SnapsToDevicePixels
属性,我读到在 Silverlight 中有一个 UseLayoutRounding
属性,您可以在某些情况下使用它相同的效果,但它似乎不适用于 Path
.
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?
推荐答案
Dave Relyea 的 Silverlight 博客.这就是我过去用于 Silverlight 像素捕捉的方法.
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.
这篇关于Silverlight 路径模糊 - 如何对齐像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!