0
這是我用來創建Image
的代碼,我將其插入FlowDocument
。WPF FlowDocument顯示*一些*圖像但不是其他人
private static Image GetImage(string url)
{
if (url == null) throw new ArgumentNullException("url");
if (!(url.StartsWith("http://") || url.StartsWith("https://") || url.StartsWith("ftp://")))
return null;
var uri = new Uri(url, UriKind.Absolute);
var bmpImg = new BitmapImage(uri)
{
CacheOption = BitmapCacheOption.OnDemand,
};
if (bmpImg.CanFreeze) bmpImg.Freeze();
var img = new Image
{
Source = bmpImg,
Stretch = Stretch.Uniform,
Height = 120,
Width = 120,
};
return img;
}
當我創建一個文檔,並從我的服務器
Designer.CaretPosition.Paragraph.Inlines.Add(image);
一切插入圖像正常工作 - 圖像顯示爲預期。此外,the main Google Logo image工作正常,但the HackaDay Logo和其他只顯示一個空白圖像。
這可能是什麼原因?
我覺得有些網站有[hotlink prevent](http://www.htaccesstools.com/hotlink-protection/)。這可能是一個原因。 – ganchito55
@ ganchito55看起來就是這樣。作爲回答發佈,我會接受。 –
感謝您的回覆:) – ganchito55