在Image中使用后如何处理流?

Uth*_*aj. 5 c# wpf graphics image stream

我有图像流,我通过下面的代码将其转换为图像

Image imagefromstream = Image.FromStream(stream);
Run Code Online (Sandbox Code Playgroud)

当我在图形中绘制此图像时,它会绘制图像.

但是,如果我在绘制图形后处理流,则不会绘制图像.

任何人都可以帮助我处理图像流

Bal*_*ick 7

根据MSDN 在这里:

You must keep the stream open for the lifetime of the Image.

关闭应用程序时(或不再需要图像时),您必须处理流