C#添加二维码带加密带logo
2021-06-11 18:07
标签:[] server tin accept map contex settings field logo C#添加二维码带加密带logo 标签:[] server tin accept map contex settings field logo 原文地址:https://www.cnblogs.com/wangjp-1233/p/10548930.html#region 生成QR码,加密与logo在此处修改
public static void CreateQr(string strQrContent, DataTable myTable)
{
Qr q = new Qr();
byte[] bylogo = null;
//加密?
//logo
if (ConfigurationManager.AppSettings.AllKeys.Contains("Logo") && ConfigurationManager.AppSettings["Logo"] != null)
{
string strLogoFileName = ConfigurationManager.AppSettings["Logo"];
FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath(string.Format("~/res/images/logo/{0}", strLogoFileName)));
Bitmap bmp = new Bitmap(file.FullName);
MemoryStream m = new MemoryStream();
bmp.Save(m, ImageFormat.Jpeg);
bylogo = m.GetBuffer();
}
myTable.Columns.Add(LY_QR_TABLE.QRCODE_FIELD, typeof(System.Byte[]));
byte[] byqr = q.GetQr(strQrContent, bylogo);
myTable.Rows[0][LY_QR_TABLE.QRCODE_FIELD] = byqr;
myTable.AcceptChanges();
}