/// <summary> /// 生成二维码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button2_Click(object sender, EventArgs e) { string ImageName = string.Empty; string a = MyStatesGTL.CreateQRCode("http://www.baidu.com", "C:", ref ImageName); Img.ImageUrl = a; }
protected void Page_Load(object sender, EventArgs e) { Bitmap bmp = MyStatesGTL.CreateTempQRCode("http://www.baidu.com"); MemoryStream ms = new MemoryStream(); bmp.Save(ms, ImageFormat.Jpeg); ms.WriteTo(Response.OutputStream); ms.Dispose(); }
private void CreateQRCode() { //string a =string.Empty; //string bpath = string.Empty; //float af = (float)1.0; //bpath=MyStatesGTL.CreateQRCode("http://www.baidu.com", "E:\\MyProject\\MyDataBase\\GDataBS\\Images\\", ref a); //MyStatesGTL.DrawImage(bpath, "E:\\MyProject\\MyDataBase\\GDataBS\\Images\\log.png", af, ImagePosition.Center, "E:\\", DateTime.Now.ToString("yyyymmddhhmmss")); //Images.ImageUrl ="/images/"+a; //http://m.lepin168.com/Shanghu/BeiTuiguang/78DD3568-F2C2-4F83-B658-D943D230CA91 Bitmap bmp = MyStatesGTL.CreateQRCodeWithLogo("http://www.baidu.com", Get_img("http://img.lepin168.com/upload/file/20170216/6362285766793600009713878.gif")); string path = DateTime.Now.ToString("yyyymmddhhmmss") + ".jpg"; System.Drawing.Image imgPhoto = new System.Drawing.Bitmap(bmp); imgPhoto.Save("E:\\MyProject\\MyDataBase\\GDataBS\\Images\\" + path); imgPhoto.Dispose(); //System.Drawing.Image imgPhotodes = new System.Drawing.Bitmap("E:\\MyProject\\MyDataBase\\GDataBS\\Images\\log.png"); //imgPhotodes.Dispose(); Images.ImageUrl = "/Images/" + path; //Graphics grWatermark = Graphics.FromImage(bmp); //bmp.Save("E:\\MyProject\\MyDataBase\\GDataBS\\Images\\" + DateTime.Now.ToString("yyyymmddhhmmss")+".jpg"); //bmp.Dispose(); }