如何在C#Windows窗体中使用文件流添加图像? [英] How to add image using filestream in C# windows forms?

查看:89
本文介绍了如何在C#Windows窗体中使用文件流添加图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用文件流将公司徽标添加到.pdf或文本文件中.我已经添加了文本,但是我想在其中添加公司徽标或任何图像.那么我如何添加或插入它呢? 请给我解决方法....

谢谢....

I want to add company logo into .pdf or text file using file stream. I have added the text but I want to add company logo or any image in it. so how i add or insert it????
Please give me solution....

Thank You....

推荐答案

亲爱的朋友,

您可以尝试以下代码:-

Dear Friend,

You can try this code:-

Image image = Image.FromFile( @"c:\image.bmp" );
using(MemoryStream stream = new MemoryStream())
{
 // Save image to stream.
 image.Save( stream, ImageFormat.Bmp );
}



希望这可以帮助你.在这里,您可以以与输出文本流相同的方式输出图像流.

如果您有帮助,请不要忘记将其标记为答案.

随时欢迎任何疑问.

问候

Varun Sareen



Hope this helps you out. From here you can output the image stream the same way you did for Text stream.

Please don''t forget to mark this as your answer if it helps you out.

Any query is always welcome.

Regards

Varun Sareen


这篇关于如何在C#Windows窗体中使用文件流添加图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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