在WPF的Image控件中显示静态的图像

来源:互联网 发布:sql named pipes 编辑:程序博客网 时间:2024/04/29 08:27

在WPF的Image控件中显示静态的图像

string path= System.Environment.CurrentDirectory+ "\\logo.png";//获取图片绝对路径BitmapImage image = new BitmapImage(new Uri(path, UriKind.Absolute));//打开图片logo.Source = image;//将控件和图片绑定,logo为Image控件名称