您的位置:首页 > 其它

今日问题汇总-WPF中更改Image控件的source、WPF 去掉窗体边框

2015-09-15 20:39 591 查看
1.Image控件的Source属性不知道后台怎么赋值

解决:

WPF中更改Image控件的source(使用相对路径)

博客地址:http://blog.csdn.net/cdjcong/article/details/8491292



绝对路径:

BitmapImageimagetemp = new BitmapImage(new Uri("E:\\Work\\Demo2.bmp",UriKind.Absolute));

image1.Source= imagetemp;



相对路径:

BitmapImageimagetemp = new BitmapImage(newUri("\\bin\\Debug\\Sources\\ON_btn_AutoDetect.bmp",UriKind.Relative));

image1.Source= imagetemp;

2.WPF去掉窗体边框

解决:

WPF 去掉窗体边框

链接地址:http://blog.sina.com.cn/s/blog_8600e72b0101exxn.html
设置 WindowStyle="None"、 AllowsTransparency="True"
即可。如下:
Window x:Class="WpfApplication1.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"   
·     WindowStyle="None"  
·     AllowsTransparency="True">  
·     <Grid>  
·     </Grid>  
· </Window>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: