首页 > 解决方案 > 显示像素化图像/文本的 C# WPF 应用程序

问题描述

今天我遇到了一件奇怪的事情,这件事从来没有发生在我身上,我以前也没有经历过。因此,让我详细介绍一下,我的朋友制作了一个带有图层的 Photoshop 图像,我将用它来制作他的软件,但是,当我尝试在 wpf 应用程序上一层一层地添加类似的图层时,并且在修复之后使用 Stretch 东西的纵横比,我发现它看起来和 Photoshop 中的原始图片不太一样,就像,我已经把所有的图层都放好了,当然每一个都是分开的,因为,稍后我会与他们,让我给你看一些图像。但看起来仍然缺少一些像素并且文本显示不正确。

这是程序界面:

程序界面

这是 Photoshop 图像:

Photoshop 图像

这是我的 XML 代码:

<Window x:Class="OlympusSimple.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" ResizeMode="NoResize" WindowStyle="None" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="400" Width="800">
<Grid>
    <Image Height="400" HorizontalAlignment="Left" Name="BackgroundUpbarBlur" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/BackgroundUpbarBlur.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="BackgroundUpbar" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/BackgroundUpbar.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="Olympus" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Olympus.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="Upbar" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/UpBar.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="Minimize" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Minimize.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="FullScreen" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/FullScreen.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="Close" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Close.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="SelectFile" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/SelectFile.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="SelectDestination" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/SelectDestination.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="ButtonDiscordUnready" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/ButtonDiscordUnready.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="RestoreAll" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/RestoreAll.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="Tutorial" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Tutorial.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="Twitter" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Twitter.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="Patreon" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Patreon.png" Margin="0,0,0,0" />
    <Image Height="400" HorizontalAlignment="Left" Name="Discord" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Discord.png" Margin="0,0,0,0" />


</Grid>

我已经搜索并没有找到任何可以引导我找到解决方案的东西,所以如果有人可以帮助我,将不胜感激。

标签: c#wpfimage

解决方案


推荐阅读