Letter on the picture (C #)

zhaozj2021-02-16  85

The following code implements the picture from the clipboard, then writes the word, save it to the file image bmap; idataObject data = system.Windows.Forms.clipboard.GetDataObject (); bmap = (image) (data.getdata (typeof .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 ("ZydzyDydedydyydydy", DrawFont, Drawbrush, XPOS, YPOS);

String spicy = "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;

转载请注明原文地址:https://www.9cbs.com/read-14194.html

New Post(0)