我的图像是模糊的!为什么不是WPF的SnapsToDevicePixels工作? [英] My images are blurry! Why isn't WPF's SnapsToDevicePixels working?

查看:309
本文介绍了我的图像是模糊的!为什么不是WPF的SnapsToDevicePixels工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用一些图片在我的WPF的applcation。

I'm using some Images in my WPF applcation.

XAML:

<Image Name="ImageOrderedList"
       Source="images/OrderedList.png"
       ToolTip="Ordered List"
       Margin="0,0,5,5"
       Width="20"
       Height="20"
       SnapsToDevicePixels="True"
       MouseUp="Image_MouseUp"
       MouseEnter="Image_MouseEnter"
       MouseLeave="Image_MouseLeave" />

但他们出现模糊:

But, they appear fuzzy:

死链接 -

下面是一个放大的,侧方比较。一个原来是左边:

Here's a zoomed-in, side-by-side comparison. An original is on the left:

死链接 - 模糊WPF图像缩放

为什么不说 SnapsToDevicePixels =真行prevent这个问题?

Why doesn't that SnapsToDevicePixels="True" line prevent this problem?

推荐答案

您可能要考虑尝试用一种新的属性现在在 WPF4 。离开 RenderOptions.BitmapScalingMode 来的高品质的或只是不申报。

You may want to consider trying a new property available now in WPF4. Leave the RenderOptions.BitmapScalingMode to HighQuality or just don't declare it.

最近邻的工作对我来说,除了它的应用放大时导致锯齿的位图。它也似乎没有解决,其中的图标是在奇怪的方式上浆任何故障。

NearestNeighbor worked for me except it led to jaggy bitmaps when zooming in on the application. It also didn't seem to fix any glitches where icons were sizing in weird ways.

在你的根元素(也就是你的主窗口)添加该属性: UseLayoutRounding =真

On your root element (i.e. your main window) add this property: UseLayoutRounding="True".

有一个属性previously只在Silverlight中已经修复了所有的位图大小的困境。 :)

A property previously only available in Silverlight has now fixed all Bitmap sizing woes. :)

这篇关于我的图像是模糊的!为什么不是WPF的SnapsToDevicePixels工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆