wpf 窗体添加背景图片

时间:2015-01-30 17:35:21   收藏:0   阅读:1176

方法一:
xaml中:
<控件>   
<控件.Background>
<ImageBrush ImageSource="/WpfApplication1;component/Images/xxx.jpg"/>
</控件.Background>
</控件>   

方法二:
xxxx.cs中:
ImageBrush b3 = new ImageBrush();
b3.ImageSource = new BitmapImage(new Uri(path, UriKind.RelativeOrAbsolute));
this.Background = b3;

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!