关于WPF中用ViewBox为程序添加背景图片的问题
MSDN上说“可以使用 Viewbox 控件来拉伸或缩放子元素”。所以我想利用ViewBox为程序添加可动态拉伸的背景图片。
<Window x:Class="UsingDecorators.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid Margin="0"> <Viewbox Margin="0" Height="350" Width="525" Stretch="Uniform" StretchDirection="Both"> <Image Margin="0" Height="350" Name="image1" Stretch="Fill" Width="525" Source="/UsingDecorators;component/Images/17.jpg" /> </Viewbox> </Grid> </Window>