欢迎光临
我们一直在努力

在图片上写字 (C#)-.NET教程,C#语言

建站超值云服务器,限时71元/月

下面的代码实现了从剪贴板取出图片,然后写上字,保存到文件

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;

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 在图片上写字 (C#)-.NET教程,C#语言
分享到: 更多 (0)

相关推荐

  • 暂无文章