Referencing the Zxing class library
Implementation features:
1 Create a QR code with logo
2 drawing the QR code onto the image
3 drawing text on a picture
Generate two-dimensional code
public string Createqrcode (string md5str,string name,int sex) {string str = sex = = 1? "Sir": "Lady"; String Logopath = AppDomain.CurrentDomain.BaseDirectory + "/logo.png"; String Qrcodepath = path + DateTime.Now.ToString ("YYYYMMDDHHMMSS") + ". jpg"; String Yqpath = AppDomain.CurrentDomain.BaseDirectory + "/yq2.jpg"; String Yqcardpath = path + TCOMMON.MD5 (DateTime.Now.ToString ("Yyyymmddhhmmss")) + ". jpg"; if (directory.exists (path) = = False)//create the file folder {directory.createdirectory (path) if it does not exist; } Generate3 (Md5str,logopath,qrcodepath); Image qrcodeimg = new Bitmap (Qrcodepath); Image image = new Bitmap (Yqpath); Graphics IG = graphics.fromimage (image); Font font = new Font ("Arial", 38,fontstyle.bold); Font font2 = new Font ("Stxinwei", fontstyle.bold); Brush brush = System.Drawing.Brushes.Black; SIzef size = IG. MeasureString (name, Font2); SizeF size2 = IG. MeasureString (str, font); Ig. DrawString (name, font, brush, 720-size. Width-size2.width)/2, 680); Ig. DrawString (str, font, brush, 720-size. Width-size2. Width)/2 + size. Width, 680); Ig. FillRectangle (Brushes.white, 280, 351, 160, 160); Ig. DrawImage (qrcodeimg, 285, 356); Image. Save (Yqcardpath); Return yqcardpath.substring (2); Create text on picture