日期:2014-05-17 浏览次数:21166 次
void Fun(Image image) { MemoryStream ms = new MemoryStream(); image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); bytes = StreamToBytes(ms); Stream ms2 = BytesToStream(bytes); if (Form == null) { Form = new Form2(); Form.pictureBox1.Image = Image.FromStream(ms2);//参数无效 Form.ShowDialog(); } } private byte[] StreamToBytes(Stream stream) { byte[] bytes=new byte[stream.Length]; stream.Read(bytes, 0,bytes.Length); stream.Seek(0, SeekOrigin.Begin); return bytes; } private Stream BytesToStream(byte[] bytes) { Stream stream = new MemoryStream(bytes); return stream; }