C#添加二维码带加密带logo

#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();
        }

 

posted @ 2019-03-17 21:17  王小鹏  阅读(298)  评论(0编辑  收藏  举报