请问如何获取按钮的背景图片。以供后面的页面使用。如何定义如何获取呢?
<Window x:Class="WpfCoupon.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="573" Width="612">
<Grid Height="514" Width="572">
<Button HorizontalAlignment="Left" Margin="20,22,0,0" Name="button1" Width="136" Height="142" VerticalAlignment="Top" Click="button1_Click">
<Image Source=".\Images\wpf.jpg" Stretch="Fill" ImageFailed="Image_ImageFailed" Height="142" Width="136" />
</Button>
<Button Height="142" Width="136" Margin="184,22,240,0" Name="button2" VerticalAlignment="Top" Click="button2_Click">
<Image Source=".\Images\a.jpg" Stretch="Fill"/>
</Button>
</Grid>
</Window>
bitmapimage bi=(button1.Content as Image).ImageSoures;
ui.Background=new Imagebrush(bi);
大致是这样,有单词上的错误,请详解。
目测楼上可行