有没有办法在 WPF 中显示存储在内存中的图像?
我得到的是类似屏幕截图制作应用程序的东西。 (成功序列化,感谢上帝!!!)单击按钮时,通过访问处理类的方法来获取屏幕截图。现在棘手的部分是该类有另一种方法来操作上述结果,以这种方式,而不是调用相应的处理方法时,创建一个窗口(显示)并且位图图像应进入显示容器中那个窗户。问题是,到目前为止,我注意到在 WPF 中,图像控件的源不能归因于存储图像的变量。我如何显示存储在该变量中的图像,而不必先保存它,获取 uri 等。 ?
What I got is something like a screenshot making application. (managed to serialize, thank god!!!) When a button is clicked a screenshot is taken by accessing a handling classe's method. now the tricky part is that the class has another method for operating with the above said result, in such a manner than when the respective handling method is called, a window is created(shown) and the bitmap image should go into a display container in that window. The problem is that so far, I've noticed that in WPF the image control's source cannot be attribuited to a variable which stores the image. How can i display the image stored in that variable without having to save it first,get uri,etc. ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要从内存流创建图像,这已经被很多人详细记录。以下是两个可以帮助您入门的链接:
http://forums.silverlight.net /forums/p/44637/166282.aspx
http://www.wpftutorial.net/Images .html
You need to create an image from a memory stream, this has been well documented by many people. Here are two links that may get you started:
http://forums.silverlight.net/forums/p/44637/166282.aspx
http://www.wpftutorial.net/Images.html
感谢您的链接。我是这样做的:
我基本上将我在这些页面上找到的内容与我找到的有关如何将 bmp 传递到内存流的一些信息结合起来。我让它 100% 工作:)
thanks for the links slugster. Here's how I did it:
I've basically combined what I had found on those pages with some info I found on how to pass on a bmp to a memstream. I got this to work 100% :)