我的文档中有以下XAML:
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom"
Height="100" Width="100"
BorderBrush="Red" BorderThickness="2">
<Image x:Name="image"
Source="http://myinternalserver/mywebservice/getimage.aspx?id=1234&ContentType=Image" />
</Border>图像在Win10和Win8中显示得很好,但在Win7中,我得到的只有一个红色边框,背景透明,里面没有图像。当我使用一个静态URL,像谷歌的标志,它呈现在所有版本。
有人知道我如何在Windows 7中进行图像渲染吗?
发布于 2016-08-31 11:57:58
根据this post,不能将WebUrl指定为BitmapImage的源。我建议您创建一个帮助类,而不是在视图的代码隐藏中这样做。另外,为了提高性能,我会冻结创建的映像。
发布于 2016-08-29 17:56:54
尝试通过从代码隐藏文件中订阅Image.ImageFailed事件来检查可能的异常:
public MainWindow()
{
InitializeComponent();
image.ImageFailed += ImageFailed;
}
private void ImageFailed(object sender, ExceptionRoutedEventArgs e)
{
Console.WriteLine(e.ErrorException);
}https://stackoverflow.com/questions/38925322
复制相似问题