当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 在图片上写字 C#

ASP.NET
用 Asp.Net 建立一个在线 RSS 新闻聚合器的方法
关于前台调用后台事件__doPostBack函数
Bin 和 App_Code 文件夹介绍
.NET 2.0 的压缩功能代码
解决Visual Studio 2005 无法显示设计视图的方法
asp.net(c#)两种随机数的算法,可用抽考题
asp.net下url传递中文的解决方案
XmlReader 读取器读取内存流 MemoryStream 的注意事项
asp.net下创建、查询、修改带名称空间的 XML 文件的例子
使用.NET存储XML数据的方法
XslTransform.Transform将结果输出到字符串里的方法
安装 VS2005 SP1 有关问题的解决办法
asp.net下中文验证码,免费开源代码
自定义应用程序配置文件(app.config)
asp.net下使用DIME协议上传文件
动态改变ASP.net页面标题和动态指定页面样式表的方法
WEB上调用HttpWebRequest奇怪问题的解决方法
HTTP协议下用Web Service上传大文件的解决方案
asp.net下Response.ContentType类型汇总
ASP.NET User Control使用技巧一则

ASP.NET 中的 在图片上写字 C#


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 222 ::
收藏到网摘: n/a


下面的代码实现了从剪贴板取出图片,然后写上字,保存到文件Image bmap;IDataObject data = System.Windows.Forms.Clipboard.GetDataObject();bmap = (Image)(data.GetData(typeof(System.Drawing.Bitmap)));Graphics g = Graphics.FromImage(bmap);
SolidBrush drawBrush = new SolidBrush(Color.Red);Font drawFont = new Font("Arial", 10, FontStyle.Bold, GraphicsUnit.Millimeter);int xPos = bmap.Height - ( bmap.Height-25 );int yPos = 3; g.DrawString ("zydzydyzydydydyyydydy", drawFont, drawBrush, xPos, yPos);
string sPicPath = "d:\\filename.jpg";string sPreFix = "d:\\xxx";
Image smBmap ;
smBmap = bmap.GetThumbnailImage(bmap.Width, bmap.Height, null, System.IntPtr.Zero);
smBmap.Save(sPicPath, System.Drawing.Imaging.ImageFormat.Jpeg);
bmap.Save(sPreFix + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);bmap = null;smBmap = null;