首页 新闻 会员 周边

wpf点击按钮获取按钮背景图片

0
[待解决问题]

请问如何获取按钮的背景图片。以供后面的页面使用。如何定义如何获取呢?

<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>

未页的主页 未页 | 菜鸟二级 | 园豆:226
提问于:2012-11-20 10:57
< >
分享
所有回答(2)
0

bitmapimage bi=(button1.Content as Image).ImageSoures;

ui.Background=new Imagebrush(bi);

大致是这样,有单词上的错误,请详解。

中文代码 | 园豆:951 (小虾三级) | 2012-11-21 13:50
0

目测楼上可行

Big_Wang | 园豆:114 (初学一级) | 2012-11-25 21:49
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册