二进制写入器流式传输或二进制写入器位图 [英] binarywriter to stream or binarywriter to bitmap

查看:100
本文介绍了二进制写入器流式传输或二进制写入器位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们
我想知道如何将二进制写入器转换为流或将二进制写入器转换为位图
此致

您不能转换"它们.整个概念没有任何意义.

首先:System.IO.BinaryWriter vs. System.IO.Stream.第一类是第二类的专用包装器(二进制,只写).请参阅:
http://msdn.microsoft.com/en-us/library/system.io. binarywriter.aspx [ ^ ].

我需要解释更多吗? (叹气……)沉默?在您的眼中,我可以看出我做得更好.好的.您可以根据Stream的实例构造一个writer,并且/或者稍后使用System.IO.BinaryWriter.BaseStream将该实例获取:
http://msdn.microsoft.com/en-us/library/atxb4f07.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/d4w83hdt.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system. io.binarywriter.basestream.aspx [ ^ ].

现在是Bitmap吗? System.Drawing.BitmapSystem.Drawing.Image,请参见:
http://msdn.microsoft.com/en-us/library/system.drawing. bitmap.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.drawing. image.aspx [^ ].

您可以使用Image方法(请参见上文)来处理流.请在上面引用的MSDN文章中找到FromStreamSave方法.

而已.没有转化".

—SA


hi guys
i want to know how can i convert the binarywriter to stream or binarywriter to a bitmap
best regards

解决方案

You cannot "convert" them. The whole notion makes no sense.

First: System.IO.BinaryWriter vs. System.IO.Stream. First class is a specialized wrapper (binary, write-only) over the second one. Please see:
http://msdn.microsoft.com/en-us/library/system.io.binarywriter.aspx[^].

Do I have to explain more? (Sigh…) Silence? I can see in your eyes that I better do. OK. You can construct a writer out of the instance of the Stream and/or later get this instance using System.IO.BinaryWriter.BaseStream:
http://msdn.microsoft.com/en-us/library/atxb4f07.aspx[^],
http://msdn.microsoft.com/en-us/library/d4w83hdt.aspx[^],
http://msdn.microsoft.com/en-us/library/system.io.binarywriter.basestream.aspx[^].

A Bitmap now? The System.Drawing.Bitmap is System.Drawing.Image, please see:
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.image.aspx[^].

You can use Image methods (see above) to work with streams; please locate FromStream and Save method in the MSDN article referenced above.

That''s it. No "conversions".

—SA


这篇关于二进制写入器流式传输或二进制写入器位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆