这是在论坛中有人提出的一个问题,原贴见:Graphics DrawString参数无效。这里给出方法,读者可以自行修改以适应自己的项目需求。

先上代码:

if (!Page.IsPostBack)
{
try
{
string str = Server.MapPath("~/upload/test.jpg");
System.Drawing.Image myImage = System.Drawing.Image.FromFile(str);
Bitmap map = new Bitmap(myImage);
myImage.Dispose();
Graphics graphics = Graphics.FromImage(map);
graphics.InterpolationMode = InterpolationMode.HighQualityBilinear;
SolidBrush brush = new SolidBrush(Color.Red);
PointF P = new PointF(, );
Font font = new Font("宋体", );
graphics.DrawString("guwei4037", font, brush, P);
map.Save(str.Substring(, str.LastIndexOf("\\") + ) + "new" + str.Substring(str.LastIndexOf("\\") + , str.LastIndexOf(".") - str.LastIndexOf("\\") - ) + str.Substring(str.LastIndexOf("."), str.Length - str.LastIndexOf(".")), ImageFormat.Jpeg);
font.Dispose();
graphics.Dispose();
}
catch { }
}

最新文章

  1. Keepalived双机热备
  2. 转自知乎:GitHub基本功能
  3. 30天,O2O速成攻略【8.22北京站】
  4. Eclipse中没有andriod问题解决方法
  5. outlook新邮件到达提醒设置以及outlook最小化到托盘设置
  6. env1
  7. C++ 中类的构造函数理解(二)
  8. iOS 开发--github的demo
  9. 基于CodeBlocks上的wxWidgets开发环境配置
  10. sql server 发布时提示'dbo.sysmergepublications'无效的解决办法
  11. Linux C 调用MYSQL API 函数mysql_escape_string()转义插入数据
  12. [问题解决] "Nautilus could not create the required folder "/home/kenneth/.config/nautilus"
  13. 在VirtualBox虚拟机上采集Fedora15系统
  14. matlab中使用elseif和if嵌套的对比
  15. C#编写一个大字母游戏,详细代码,不懂问博主。。。。
  16. SLAM+语音机器人DIY系列:(二)ROS入门——4.如何编写ROS的第一个程序hello_world
  17. A页面跳转到B页面后打开指定tabs标签
  18. jpa 联合查询方法
  19. lombok @EqualsAndHashCode 注解的影响
  20. Postgres安装

热门文章

  1. C#多线程的介绍(园子里比较全的一篇)
  2. SQL Server压缩日志及数据库文件大小
  3. Asp.Net 之 通过调用 WScript.Shell 启动本地 exe 程序时产生“ automation服务器不能创建对象 ”的错误
  4. Android 高级UI设计笔记08:Android开发者常用的7款Android UI组件(转载)
  5. Debian 7 安装 Docker
  6. hdu 1195 广度搜索
  7. Nginx - Additional Modules, SSL and Security
  8. 第六节 ADO.NET
  9. 和阿文一起学H5-- H5排版八大套路
  10. jquery学习--选择器