关于传图片问题,急! 请问如何利用Winsock传输图片,并进行远程操控,最好能有代码实例,简单些的也可以,分不够可以加 !谢谢!敬请高手出马! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不就跟sock传文件或二进制一样的吗? 用socket传输文件的http://dns.tlw.cn/12001.htm 谢谢关注我的提问,敬请高手出马!string fn=@" c:\Capture.Gif "; //当前需要传送的图片目录文件名//二进制读取FileStream fs = new FileStream(fn,FileMode.Open, FileAccess.Read);int byteLength = (int)fs.Length;byte[] msg = new byte[byteLength];fs.Read(wf,0,byteLength);fs.Close();fs = null;//此时wf 就是一个 byte[] 数组mySocket.Send .... //发给对方//从byte[] 显示图片的方法this.pictureBox1.Image = Image.FromStream(new MemoryStream(wf));能否用这种方法实现传送和显示?这是我刚刚找到. 再问个问题:this.pictureBox1.Image = Image.FromStream(new MemoryStream(wf));是不是放在public Form1() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // }这个里面的? {System.IO.MemoryStream stream2 = new System.IO. MemoryStream();pictureBox1.Image.Save(stream2,System.Drawing.Imaging.ImageFormat.Gif);Bitmap bitmap1 = new Bitmap(stream2, true);bitmap1.Save(stream2, System.Drawing.Imaging.ImageFormat.Gif);bitmap1.Dispose();Byte[] bt = stream2.ToArray();stream2.Close();} 读取google搜索结果出错 如何拷贝文件到另一个路径下? 怎么获取qq聊天窗口的聊天信息,以及怎么实现写,发消息? c# 实例化一个form? 如何感知鼠标移进我的窗体,或移出我的窗体? 找几本书 如何使控件获得焦点 DEV gridcontrol控件 显示转化问题 如何在DataGrid页眉中插入排序的指示箭头? 500分用C#制作XP风格的窗体,此前已发一贴,但未解决,现继续贴,请大侠们指点 欢迎大家讨论:如何有效提高.net程序(Winform)的性能? [未能在“设计”视图中打开。在“<%..."值"...%>”块中,以不同方式将值括起来],这个问题,改怎么解决呀?
http://dns.tlw.cn/12001.htm
string fn=@" c:\Capture.Gif "; //当前需要传送的图片目录文件名
//二进制读取
FileStream fs = new FileStream(fn,FileMode.Open, FileAccess.Read);
int byteLength = (int)fs.Length;
byte[] msg = new byte[byteLength];
fs.Read(wf,0,byteLength);
fs.Close();
fs = null;
//此时wf 就是一个 byte[] 数组
mySocket.Send .... //发给对方//从byte[] 显示图片的方法
this.pictureBox1.Image = Image.FromStream(new MemoryStream(wf));
能否用这种方法实现传送和显示?这是我刚刚找到.
this.pictureBox1.Image = Image.FromStream(new MemoryStream(wf));
是不是放在
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
这个里面的?
System.IO.MemoryStream stream2 = new System.IO. MemoryStream();
pictureBox1.Image.Save(stream2,System.Drawing.Imaging.ImageFormat.Gif);
Bitmap bitmap1 = new Bitmap(stream2, true);
bitmap1.Save(stream2, System.Drawing.Imaging.ImageFormat.Gif);
bitmap1.Dispose();
Byte[] bt = stream2.ToArray();
stream2.Close();
}