繁体   English   中英

从网络加载图像时出现NullReferenceException

[英]NullReferenceException when loading image from web

<Image Name="myImage" Width="160" Height="226"/>
BitmapImage bi = new BitmapImage(new Uri(https://www.google.com/images/srpr/logo11w.png, UriKind.Absolute));
myImage.Source = bi;

这是我的代码。 没有困难,没有复杂。 但是,它在“ myImage.Source = bi”处给了我NullReferenceException。 怎么了?

BitmapImage bi = new BitmapImage(new Uri("https://www.google.com/images/srpr/logo11w.png", UriKind.Absolute));

myImage.Source = bi;

这可行。 我测试了 顺便说一下,“”丢失了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM