大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> NET专区 -> 在图片上写字 (C#)

在图片上写字 (C#)

时间: 2021-07-31 作者:daque

底下的代码实行了从剪贴板掏出图片,而后写上字,生存到文献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;

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.