• 我又遇到了gdi+一般性错误


    继上次写得随笔,关于一个gdi+的一般性错误,那个自己找到了原因。但是这个次的虽然那按照别人写得方法解决了,但是尚未明白为什么。

    通过PictureBox来保存图像到数据库,成为二进制的文件的时候,

    可能你会碰到GDI+一般性错误的消息,具体解决的办法是把他读取道
    一个新的Bitmap类中,再Save!代码如下!
    using(MemoryStream stream = new MemoryStream())
       {
        byte[] bytearr = new byte[0];
        if (this.picImage.Image != null)
        {
         try
         {
     
          Bitmap bmp = new Bitmap(picImage.Image);
          
          
          bmp.Save(stream,System.Drawing.Imaging.ImageFormat.Jpeg);
          bytearr = stream.ToArray();
          staff.StaffPhotoImg = bytearr;
         }
         catch(Exception e)
         {
          MessageBox.Show(e.Message);
         }

        } 

    算了,也不管它。就当是picture box的bug

  • 相关阅读:
    单调队列
    2019牛客暑期多校训练营(第一场)
    没有上司的舞会
    飞碟解除器
    最小费用最大流
    prim
    merge_sort
    CCF认证之——相反数
    CCF考试认证模拟练习——数字排序
    算法之分治法
  • 原文地址:https://www.cnblogs.com/worldreason/p/1307687.html
Copyright © 2020-2023  润新知