时间: 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;