未在使用Uri的图像控件中设置图片 [英] Picture not set in Image control with Uri
本文介绍了未在使用Uri的图像控件中设置图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的解决方案资源管理器图片:
http://postimage.org/image/nyrskovvn/ [
My Solution Explorer image :
http://postimage.org/image/nyrskovvn/[^]
my code in PopupWinHelper :
var img = new Image
{
BitmapEffect = new DropShadowBitmapEffect(),
Stretch = Stretch.Fill,
Source = new BitmapImage(new Uri("/WpfApplication1;component/images/PopupImage.png"))
};
我在Mainwindow中的代码:
my code in Mainwindow :
private void button1_Click(object sender, RoutedEventArgs e)
{
cuswin.PopupWinHelper.ShowPopUp(150,300,"asdad",new Thickness(20));
}
为什么会发生此错误?
然后我用:
Why does this error occur?
then I use :
var img = new Image
{
BitmapEffect = new DropShadowBitmapEffect(),
Stretch = Stretch.Fill,
Source = new BitmapImage(new Uri("/images/PopupImage.png", UriKind.Relative))
};
没有错误发生,但是图片没有显示在图像控件中.
no error occurs but the picture is not shown in image control.
推荐答案
/WpfApplication1;component/images/PopupImage.png
不是有效的URI.验证图像的路径.
/WpfApplication1;component/images/PopupImage.png
is not a valid URI. Verify the path to your image.
这篇关于未在使用Uri的图像控件中设置图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文