English 中文(简体)
以 Bitmapimage 图像添加的图像模糊
原标题:Images added as BitmapImage are blurred

我正在研究WPF 应用程序(.NET Forum 4), 我正在将.png 图像添加到资源描述中。 它看起来像 :

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="IconReset" UriSource="../Icons/IconReset.png" />
<BitmapImage x:Key="IconCopy" UriSource="../Icons/IconCopy.png" />
...
</ResourceDictionary>

然后我使用这些图像:

<Image Width="22" Height="22" Source="{DynamicResource IconReset}" SnapsToDevicePixels="True" />

它的工作良好,但应用中的图像模糊不清。 Png 图像大小为 22x22, 看上去既漂亮又清晰。

那么为什么在我的应用程序中这些图标是模糊的? 我已经尝试设置属性 < code> SnapsToDevicePixel , 但是它没有改变任何东西 。

怎样才能让它看起来像Orginal png图像? 怎样才能摆脱这个模糊不清的画面?

感激不尽的帮助!

最佳回答

尝试设置属性 :

UseLayoutRounding="True" 

最好将其设置在主窗口/ 根元素上, 然后它会影响整个应用程序 。

问题回答

暂无回答




相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签