111,129
社区成员
发帖
与我相关
我的任务
分享按二进制读取
//按二进制流的形式保存到数据库
System.IO.MemoryStream ms = new System.IO.MemoryStream();
pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
byte[] imageBytes = ms.ToArray();
//从数据库内读出的数据
byte[] imageBytes = new byte[10];
pictureBox1.Image = Bitmap.FromStream(new System.IO.MemoryStream(imageBytes));