Graphics异常,报内存不足
来源:互联网 发布:php 分销提成计算公式 编辑:程序博客网 时间:2024/05/16 05:42
原因:很有可能是因为图片大小导致的,需要通过PS修改一下图片大小
string imageName = sourceImageTb.Substring(sourceImageTb.LastIndexOf('/')); string imageSourcePath = Path.Combine(Config_MCDWX.Instance.Exam_CertificateTemplateDirectory + imageName); LogHelper.Debug(imageSourcePath); System.Drawing.Bitmap imgSrc = new Bitmap(imageSourcePath);// System.Drawing.Bitmap.FromFile(imageSourcePath); // StreamReader sr = new StreamReader(postedStream, System.Text.Encoding.UTF8); using (Graphics g = Graphics.FromImage(imgSrc)) { g.DrawImage(imgSrc, 0, 0, imgSrc.Width, imgSrc.Height); string fontFamily = "Microsoft YaHei"; if (entityEmail.CurrentLanguage == -1) { fontFamily = "Calibri"; } using (Font f = new Font(fontFamily, 20, FontStyle.Bold)) { using (Brush b = new SolidBrush(Color.FromArgb(0, 0, 0))) { // g.DrawString(title, f, b, entityEmail.CurrentLanguage == 1 ? 990 : 330, 180); int nCurrentLen = 465; if (title.Length == 2) nCurrentLen = nCurrentLen + 10; else if (title.Length == 4) nCurrentLen = nCurrentLen - 10; g.DrawString(title, f, b, entityEmail.CurrentLanguage == 1 ? nCurrentLen : 465, entityEmail.CurrentLanguage == 1 ? 270 : 270); Font f1 = new Font("Calibri", 20); g.DrawString(date, f1, b, entityEmail.CurrentLanguage == 1 ? 225 : 225, entityEmail.CurrentLanguage == 1 ? 570 : 570); // g.DrawString(date, f1, b, 130, 495); } } g.Dispose(); }
0 0
- Graphics异常,报内存不足
- 模拟器报内存不足OOM异常解决方法
- javah报错找不到类android.graphics.Bitmap的异常
- 使用eclipse报内存不足
- hive报内存不足错误
- Eclipse 报 堆内存不足
- 模拟器出现内存不足异常
- kafka 容器报内存不足异常(failed; error='Cannot allocate memory' (errno=12))
- MyEclipse报内存不足的解决方案
- sqlserver链接服务器报内存不足
- uap运行环境报内存不足错误解决方法
- eclipse经常报内存不足的原因
- Eclipse报PermGen space内存不足的解决办法
- myeclipse中启动Jboss报错,内存不足
- 解决 IDEA 运行代码,报内存不足问题
- 关于java内存不足异常的处理.
- proguard代码混淆器 内存不足异常
- 内存不足
- CreateVertexDeclaration,SetStreamSource之间的关系
- Eclipse 中 Maven 命令操作
- spring中的Map集合、视图模型
- iOS开发 指纹识别
- LeetCode 230. Kth Smallest Element in a BST
- Graphics异常,报内存不足
- NOI 2.5基本算法之搜索 走出迷宫----广搜算法的实现
- 【JAVA】抽象和封装
- ERROR: Error installing cocoapods: activesupport requires Ruby version >= 2.2.2 升级ruby
- [OpenJudge] 2.3基本算法之递归变递推 PKU2506Tiling
- 法国潜艇制造商DCNS大量文件遭泄露(附泄露样例文档下载)
- spring中的RequestMapping用户的添加
- HashMap源码解析
- 组合模式