使用下面的代码,我无法使背景图像以其原始大小显示(它总是稍大一点)。我试着改变
Stretch
<Canvas Width="500" Height="500">
<Canvas.Background>
<ImageBrush
ImageSource="{Binding ElementName=w_window, Path=BackgroundImagePath}"
Stretch="None"
AlignmentX="Left"
AlignmentY="Top"
/>
</Canvas.Background>
</Canvas>
在下图中,您可以在左侧看到我的应用程序,在右侧看到照片查看器(设置为原始大小)。
有什么建议吗?(顺便说一下,设置
ClipToBounds="True"
不起作用。)
Image
是唯一的元素,具有相同的大小调整问题。不仅仅是我的机器有这个问题(即应用程序在其他机器上有这个问题)。
<Window x:Class="DiagramDesigner.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window2" Height="300" Width="1000">
<Image
Source="C:\Users\patk\Downloads\Bottom_wnums.jpg"
Stretch="None"
HorizontalAlignment="Left"
VerticalAlignment="Top"
/>
</Window>