开发者

How can I use SnapToDevicePixels and StrokeDashArray

开发者 https://www.devze.com 2023-01-10 14:36 出处:网络
I have the following XAML code: <Path Data=\"M0,0 L 12 0 L 12 12 L 0 12 Z M 6 0 L 6 12 M 0 6 L 12 6\" StrokeDashArray=\"1 1\" Stroke=\"Black\" StrokeThickness=\"1\" SnapsToDevicePixels=\'True\">

I have the following XAML code:

<Path Data="M0,0 L 12 0 L 12 12 L 0 12 Z M 6 0 L 6 12 M 0 6 L 12 6" StrokeDashArray="1 1" Stroke="Black" StrokeThickness="1" SnapsToDevicePixels='True">
</Path>

However it looks horribly fuzzy on my screen. 开发者_StackOverflow社区Is there a solution?


If you just want a crisp, dashed path and you may be able to get the results you want by declaring the RenderOptions.EdgeMode as Aliased to prevent the framework from interpolating the path outline when a dash falls between pixel boundaries:

<Path Data="M0,0 L 12 0 L 12 12 L 0 12 Z M 6 0 L 6 12 M 0 6 L 12 6" StrokeDashArray="1 1" Stroke="Black" StrokeThickness="1" RenderOptions.EdgeMode="Aliased">
</Path>
0

精彩评论

暂无评论...
验证码 换一张
取 消