转自智慧光原文A generic error occurred in GDI+. 解决方法

使用image1.RotateFlip(RotateFlipType.Rotate90FlipNone)方法时候,出现错误:

An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll

Additional information: A generic error occurred in GDI+.

但是如果我在生成这个image类型的image1后直接调用image1.RotateFlip方法就没有问题。

原因:To
retain access to the source bits, GDI+ locks any source file, and
forces the application to maintain the life of any source stream, for
the life of the Bitmap or
the Image object.

位图和图像的构造函数依赖项

http://support.microsoft.com/?id=814675

解决方法:

Image tmp = (Image)m_List[0];

Bitmap tmpbitmap = new Bitmap(tmp);
   tmpbitmap.RotateFlip(RotateFlipType.Rotate90FlipNone);
 Image image1 = tmpbitmap;

A generic error occurred in GDI+的解决方案的更多相关文章

  1. GDI+一般性错误(A generic error occurred in GDI+)

    1.GDI+的前世今生 GDI+全称图形设备接口,Graphics Device Interface (GDI) ,他的爸爸叫做GDI, 用C写的.Windows XP出来以后用C++重新写了一下,变 ...

  2. C# GDI+发生一般性错误(A generic error occurred in GDI+))

    解决思路: 1. 因为 .net GDI+ 是对底层 的封装. 所以可以尝试用 Marshal.GetLastWin32Error();函数获得底层错误代码. try{ image.Save(file ...

  3. Exception:A generic error occurred in GDI+

    分析: 一般出现这种问题都是GDI和原数据(比如Bitmap)是同一个实体,只不过是两个引用.换句话说就是这个路径的图片被GDI占用啦. 还有一种情况是路径有问题. 场景一: WPF的Image控件的 ...

  4. A generic error occurred in GDI+. 上传图片报错

    代码就不说了,因为本地测试 ok, 服务端 就不行 ,服务器 环境 阿里云 win2008 r2  64 位 原因 是我没有这是 文件加权限 : 左边 的 少了 权限~ 代码 :含义是 网络图片 裁剪 ...

  5. IAR FOR STM8S 错误 An error occurred while retrieving GDI features: gdi-error [40201]解决方法

    今早使用IAR调试编译调试一个工程,发现IAR竟然出现如下错误信息 An error occurred ]: Can't access configuration database 在网上查看了一下, ...

  6. Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.

    背景 运行时代码报错: selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occ ...

  7. Genymotion出现unknown generic error和This may occur if you are using a proxy错误的解决方案

    今天在实验室希望在Genymotion上多下载几个模拟器,需要重新登录帐号,却发现一个错误,叫做unknown generic error.前几天还出现过一个很诡异的问题.截图如下: . (1)unk ...

  8. Eclipse启动时发生An internal error occurred during: "Initializing Java Tooling".错误的解决方法

    问题描述: Eclipse启动时发生An internal error occurred during: "Initializing JavaTooling".错误的解决方法 解决 ...

  9. 使用MyEclipse新建maven项目时报An internal error occurred during: "Retrieving archetypes:". GC overhead limit

    前几天在上手maven时,遇到了一个十分头疼的问题,我的myeclipse配置的是自己安装的插件 ,总是报 " An internal error occurred during: &quo ...

随机推荐

  1. js实现百度,淘宝搜索功能

        Common.js //封装类名 function byClassName(sClassName){ if(document.getElementsBYClassName){ return d ...

  2. 【剑指offer-25】合并两个单调递增的链表,C++实现(链表)

    原创博客,转载请注明出处! 1.题目 输入两个单调递增的链表,输出两个链表合成后的链表(单调不减). 2.思路(递归) # 鲁棒性: 如果链表1是空链表,则直接输出链表2. 如果链表2是空链表,则直接 ...

  3. html(对php也有效)页面自动刷新和跳转(简单版本)

    <html>    <head><title>html页面自动刷新和跳转</title><meta http-equiv="Refres ...

  4. Ubuntu和win双系统删除ubuntu开机出错

    Ubuntu和win双系统删除ubuntu开机出错问题. 报错error:unknown filesystem. grub rescue>_ 很简单: 进入pe 打开diskgenius 选择你 ...

  5. JPA级联(一对一 一对多 多对多)注解【实际项目中摘取的】并非自己实际应用

    下面把项目中的用户类中有个:一对一  一对多  多对多的注解对应关系列取出来用于学习      说明:项目运行正常 问题类:一对多.一对一.多对多 ============一对多 一方的设置 @One ...

  6. mysql 导入 csv文件中数据,只能导入第一行

    用workbench导入csv数据,只能导入数据的第一行,也就是标注每一列的列名的那一行.但问题是,每次导入完成时,系统提示已经导入了500条记录(这个文件中的确有500条记录),可是刷新数据库后打开 ...

  7. Cookie用法

    //写入 protected void Button1_Click(object sender, EventArgs e) { HttpCookie cookie=new HttpCookie(&qu ...

  8. 再也不用克隆多个仓库啦!git worktree 一个 git 仓库可以连接多个工作目录

    我在 feature 分支开发得多些,但总时不时被高优先级的 BUG 打断需要临时去 develop 分一个分支出来解 BUG.git 2.6 以上开始提供了 worktree 功能,可以解决这样的问 ...

  9. 零基础学习hadoop到上手工作线路指导初级篇:hive及mapreduce

      此篇是在零基础学习hadoop到上手工作线路指导(初级篇)的基础,一个继续总结.五一假期:在写点内容,也算是总结.上面我们会了基本的编程,我们需要对hadoop有一个更深的理解:hadoop分为h ...

  10. MySQL之——查询重复记录、删除重复记录方法大全

    查找所有重复标题的记录: SELECT * FROM t_info a WHERE ((SELECT COUNT(*) FROM t_info WHERE Title = a.Title) >  ...