//读取DataSet中以二进制(Image)形式保存的图片
byte[] byteImage = (byte[])dataSet11.tBGPicture.Rows[2]["PicContent"];
//转成MemoryStream类型
System.IO.MemoryStream stream = new System.IO.MemoryStream(byteImage, true);
//stream.Write(byteImage, 0, byteImage.Length);
byte[] byteImage = (byte[])dataSet11.tBGPicture.Rows[2]["PicContent"];
//转成MemoryStream类型
System.IO.MemoryStream stream = new System.IO.MemoryStream(byteImage, true);
//stream.Write(byteImage, 0, byteImage.Length);
//显示图片
pictureBox1.Image = Image.FromStream(stream);
//关闭stream
stream.Close();
本文介绍了一种从DataSet中以二进制形式读取图片的方法,并将其转换为MemoryStream以便在PictureBox中显示。通过具体的C#代码实现,展示了如何处理图像数据,适用于Windows Forms应用程序。
4077

被折叠的 条评论
为什么被折叠?



