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

ASP.NET
asp.net 动态生成表格
asp.net 程序优化精选
DataGridView自动调整行高和行宽
asp.net+js实现的ajax sugguest搜索提示效果
asp.net 将设有过期策略的项添加到缓存中
asp.net SqlDataAdapter对象使用札记
DataGrid 动态添加模板列 实现代码
asp.net 设置GridView的选中行
the sourcesafe database has been locked by the administrator之解决方法
asp.net 退出登陆(解决退出后点击浏览器后退问题仍然可回到页面问题)
Asp.Net HttpHandler 妙用
ASP.NET 保留文件夹详解
asp.net 中将表单提交到另一页 Code-Behind(代码和html在不同的页面)
SqlDataSource 链接Access 数据
asp.net GridView的删除对话框的两种方法
asp.net 按字节检查包含全半角的文字
asp.net String.IsNullOrEmpty 方法
asp.net System.Net.Mail 发送邮件
c# 读取文件内容存放到int数组 array.txt
asp.net Split分割字符串的方法

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 212 ::
收藏到网摘: 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;