转自智慧光原文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之吸顶效果

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. lx 与cd 的计算方法

    Candela to lux calculation with distance in meters The illuminance Ev in lux (lx) is equal to the lu ...

  3. BZOJ4974:[Lydsy1708月赛]字符串大师(逆模拟KMP)

    题目描述 一个串T是S的循环节,当且仅当存在正整数k,使得S是T k  Tk (即T重复k次)的前缀,比如abcd是abcdabcdab的循环节.给定一个长度为n的仅由小写字符构成的字符串S,请对于每 ...

  4. jquery插件的2种扩展开发(jQuery.extend和jQuery.fn.extend的区别)

    1.类级别 jQuery.extend(object) 类级别你可以理解为拓展jquery类,最明显的例子是$.ajax(...),相当于静态方法. 开发扩展其方法时使用$.extend方法,即jQu ...

  5. Codeforces1070 2018-2019 ICPC, NEERC, Southern Subregional Contest (Online Mirror, ACM-ICPC Rules, Teams Preferred)总结

    第一次打ACM比赛,和yyf两个人一起搞事情 感觉被两个学长队暴打的好惨啊 然后我一直做傻子题,yyf一直在切神仙题 然后放一波题解(部分) A. Find a Number LINK 题目大意 给你 ...

  6. LOJ2425 NOIP2015 运输计划 【二分+LCA+树上差分】*

    LOJ2425 NOIP2015 运输计划 LINK 题意:给你一颗树,可以将任意一条边的权值变成0,然后求m条路径的长度的最小值 思路: 先二分最后的距离ans,然后我们把路程大于ans的所有路径拿 ...

  7. 【java基础】java集合之TreeMap

    转载文章转载请注明出处:http://www.cnblogs.com/skywang12345/admin/EditPosts.aspx?postid=3310928 第1部分 TreeMap介绍 T ...

  8. phoenxi elixir 框架几个方便的命令

    1. 已有命令 mix app.start # Starts all registered apps mix app.tree # Prints the application tree mix ar ...

  9. bzoj1503[NOI2004]郁闷的出纳员——Splay

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1503 好奇怪呀!为什么而TLE? 各种修改终于卡时过了.可是大家比我快多了呀?难道是因为自己 ...

  10. CArray,CList,CMap如何实例化

    1.定义一个CMap,向这个CMap中增加数据项(键-值对).CMap<CString, LPCTSTR, CString, LPCTSTR>m_ItemMap;CString strKe ...