WPF 中的图像变得模糊 [英] Image in WPF getting Blurry

查看:32
本文介绍了WPF 中的图像变得模糊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 C# 在 WPF 中开发应用程序.我将图像放入 WrapPanel 并在带有一个边框的网格中显示,并在按钮中使用图像.问题是我的图像控制失去了它的质量.我无法在这里发布我的图片,所以我只是在这里描述.

I am developing an application in WPF using C#. I am putting Images in a WrapPanel and showing inside a Grid with one more Border and using images in Buttons also. Problem is my Image control loosing its quality. I am not able to post my image here so I am simply describing here.

我使用 SnapsToDevicePixels="True" 作为图像,但看起来仍然很模糊.

I used SnapsToDevicePixels="True" for the images but still it looks blurry.

更新:

在这里我分享了下面的图片:

Here I shared the Image below:

推荐答案

我认为 Markus 所说的是解决您的问题的一种方法,并尝试在其中添加一个属性 RenderOptions.EdgeMode="Aliased" 对于每个图像我的意思是:

I think what Markus told is the one way to resolve your issue and try by adding one more property in it RenderOptions.EdgeMode="Aliased" for each image I mean :

<Image Source="/LoginPanel;component/Icons/icoLogin.ico"
       RenderOptions.BitmapScalingMode="NearestNeighbor"
       RenderOptions.EdgeMode="Aliased"/>

如果你仍然无法解决你的问题,那么你可以参考这个http://blogs.msdn.com/b/dwayneneed/archive/2007/10/05/blurry-bitmaps.aspx 以创建自定义位图类并应用于所有图像给你制造麻烦.

if you still not able to fix your problem then you can refer this http://blogs.msdn.com/b/dwayneneed/archive/2007/10/05/blurry-bitmaps.aspx to create a custom Bitmap class and apply on all Images which are creating trouble for you.

您还可以看到这个堆栈溢出问题

这篇关于WPF 中的图像变得模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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