2012-10-18 74 views
0

我在運行時從第三方DLL獲取格式爲System.Drawing.Image的圖像。此圖像將被設置爲UI上的WPF圖像控件。如何實現這一點。如何在WPF的圖像控件中設置圖像?

請注意,圖像存儲在內存中,而不是存儲在磁盤上。

請幫忙。

+3

周圍有很多類似的問題。例如http://stackoverflow.com/questions/3427034/using-xaml-to-bind-to-a-system-drawing-image-into-a-system-windows-image-control –

+1

你嘗試System.Drawing。 Image.FromStream(MemoryStream的)? –

回答

0

假設圖書館的名稱是TestLibrary,圖像的路徑是/Images/Image1.png。您可以像下面那樣設置圖像的來源屬性。

<Image Source="/TestLibrary;Component/Images/Image1.png"/> 

您可以訪問Pack URIs in WPF作進一步參考。

+0

你讀過一個問題嗎? 「請注意,圖像在內存中,而不是存儲在磁盤上」。 – Dennis

相關問題