public Bitmap GetQRCodeUniqueParticipantCode(ConferenceAudienceModel _conferenceAudienceModel) { QRCoder.QRCodeGenerator QG = new QRCoder.QRCodeGenerator(); var data = QG.CreateQrCode(_conferenceAudienceModel.UniqueParticipantCode, QRCoder.QRCodeGenerator.ECCLevel.Q); var QRCode = new QRCoder.QRCode(data); MemoryStream memstream = new MemoryStream(); Bitmap QRCodeImage = QRCode.GetGraphic(20); QRCodeImage.Save(memstream, System.Drawing.Imaging.ImageFormat.Png); MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(_conferenceAudienceModel.Participant); mail.Subject = "QR Code To Join"; mail.Body = String.Format("This is an automatic message so you can join to the conference named {0} via QR Code", _conferenceAudienceModel.ConferenceName); memstream.Position = 0; var attachment = new System.Net.Mail.Attachment(memstream, "image.png"); mail.Attachments.Add(attachment); SmtpServer.Host = "smtp.gmail.com"; SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network; SmtpServer.UseDefaultCredentials = true; SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Parola12345*"); SmtpServer.EnableSsl = true; try { SmtpServer.Send(mail); } catch (Exception ex) { } return(QRCodeImage); }
private void btnGenerate_Click(object sender, EventArgs e) { string barCode = txtBarCode.Text; // QR Code if (ckQR.Checked) { QRCoder.QRCodeGenerator gr = new QRCoder.QRCodeGenerator(); var myData = gr.CreateQrCode(barCode, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(myData); pictureBox1.Image = code.GetGraphic(50); } else { // Bar Code try { Zen.Barcode.Code128BarcodeDraw barCodeObj = Zen.Barcode.BarcodeDrawFactory.Code128WithChecksum; pictureBox1.Image = barCodeObj.Draw(barCode, 60); } catch (Exception ex) { Console.WriteLine(ex.Message); } } }
/// <summary> /// 生成二维码 /// </summary> /// <param name="value">需要生成的值</param> /// <param name="pixelsPerModule">像素</param> /// <param name="level">级别</param> /// <param name="drawQuietZones">是否生成白色边框</param> /// <param name="ico">ico logo</param> /// <param name="iconSizePercent">log大小比例</param> /// <param name="iconBorderWidth">log的边框</param> /// <returns></returns> public Bitmap GetQRCode(string value, int pixelsPerModule = 8, QRCodeLevel level = QRCodeLevel.M, bool drawQuietZones = true, Bitmap ico = null, int iconSizePercent = 15, int iconBorderWidth = 6) { QRCoder.QRCodeGenerator Tool = new QRCoder.QRCodeGenerator(); QRCoder.QRCodeData data = Tool.CreateQrCode(value, (QRCoder.QRCodeGenerator.ECCLevel)((int)level), true); QRCoder.QRCode qrcode = new QRCoder.QRCode(data); return(qrcode.GetGraphic(pixelsPerModule, Color.Black, Color.White, ico, iconSizePercent, iconBorderWidth, drawQuietZones)); }
private void InitCustomFont(string text) { QRCoder.QRCodeGenerator qr = new QRCoder.QRCodeGenerator(); QRCoder.QRCodeData data = qr.CreateQrCode(text, QRCoder.QRCodeGenerator.ECCLevel.Q); QRCoder.QRCode code = new QRCoder.QRCode(data); qrBox.Image = code.GetGraphic(10); }
private QRCoder.QRCode GenerateQRCode(string v) { QRCoder.QRCodeGenerator QRG = new QRCoder.QRCodeGenerator(); QRCoder.QRCodeData qRCodeData = QRG.CreateQrCode(v, QRCoder.QRCodeGenerator.ECCLevel.H); QRCoder.QRCode qRCode = new QRCoder.QRCode(qRCodeData); return(qRCode); }
private void button1_Click(object sender, EventArgs e) { int Index = comboBox1.SelectedIndex; switch (Index) { case 0: QRCoder.QRCodeGenerator QG = new QRCoder.QRCodeGenerator(); var Text = QG.CreateQrCode(textBox1.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var Code = new QRCoder.QRCode(Text); pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; pictureBox1.Image = Code.GetGraphic(50); break; case 1: try { Zen.Barcode.Code128BarcodeDraw brCode = Zen.Barcode.BarcodeDrawFactory.Code128WithChecksum; pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox1.Image = brCode.Draw(textBox1.Text, 40); } catch (Exception) { MessageBox.Show("Error ?"); } break; } }
public void SaveQrCode(string data, string filename, QRCoder.QRCodeGenerator.ECCLevel err_cor) { QRCoder.QRCodeData qr_data = qgen.CreateQrCode(data, err_cor); qrCode = new QRCoder.QRCode(qr_data); bitmap = qrCode.GetGraphic(100, Color.Black, Color.White, false); bitmap.Save(filename); }
public void GenerateQrCode() { QRCoder.QRCodeGenerator qrGenerator = new QRCoder.QRCodeGenerator(); string partSerialNo = string.Empty; if (traceabilityUpperLog != null) { partSerialNo = traceabilityUpperLog.PartSerialNumber; } if (traceabilityLowerLog != null) { partSerialNo = traceabilityLowerLog.PartSerialNumber; } if (!string.IsNullOrEmpty(partSerialNo)) { var qrData = qrGenerator.CreateQrCode(partSerialNo, QRCoder.QRCodeGenerator.ECCLevel.H); var qrCode = new QRCoder.QRCode(qrData); var image = qrCode.GetGraphic(150); if (traceabilityUpperLog != null) { picQRCodeUpper.Image = image; } if (traceabilityLowerLog != null) { picQRCodeLower.Image = image; } } }
private void generateBtn_Click(object sender, EventArgs e) { QRCoder.QRCodeGenerator qrGen = new QRCoder.QRCodeGenerator(); var data = qrGen.CreateQrCode(dataTxt.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(data); pictureBox1.Image = code.GetGraphic(50); }
private void Button1_Click(object sender, EventArgs e) { QRCoder.QRCodeGenerator QR = new QRCoder.QRCodeGenerator(); var IData = QR.CreateQrCode(textBox1.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(IData); pictureBox1.Image = code.GetGraphic(10); }
private void btn_Generate_QRcode_Click(object sender, EventArgs e) { QRCoder.QRCodeGenerator QG = new QRCoder.QRCodeGenerator(); var MyData = QG.CreateQrCode(txt_Input.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(MyData); pictureBox2.Image = code.GetGraphic(50); }
private void button1_Click(object sender, EventArgs e) { QRCoder.QRCodeGenerator Qg = new QRCoder.QRCodeGenerator(); var data = Qg.CreateQrCode(TB.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var Pic = new QRCoder.QRCode(data); PB.Image = Pic.GetGraphic(50); }
public IStdPicture Create(string text, int cclevel, int pixelsPerModule) { var qrCodeData = instance.CreateQrCode(text, cclevel); var qrCode = new QRCoder.QRCode(qrCodeData); var bitmap = qrCode.GetGraphic(pixelsPerModule); return(ImageToPicture(bitmap)); }
private void BtnGenerate_Click(object sender, EventArgs e) { var qg = new QRCoder.QRCodeGenerator(); var myData = qg.CreateQrCode(TxtCode.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(myData); PicQRCode.Image = code.GetGraphic(50); }
private void btnTaoMaQR_Click(object sender, EventArgs e) { QRCoder.QRCodeGenerator qr = new QRCoder.QRCodeGenerator(); var data = qr.CreateQrCode(cbbMaDocGia.Text + " " + cbbTenDocGia.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(data); pictureBox2.Image = code.GetGraphic(2); }
private void qr_Load(object sender, EventArgs e) { QRCoder.QRCodeGenerator QG = new QRCoder.QRCodeGenerator(); var mydata = QG.CreateQrCode(hai, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(mydata); pictureBox1.Image = code.GetGraphic(50); }
private void btnGenerateQR_Click(object sender, EventArgs e) { QRCoder.QRCodeGenerator QG = new QRCoder.QRCodeGenerator(); var Data = QG.CreateQrCode(e_txtName.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(Data); picQR.Image = code.GetGraphic(50); }
private void button2_Click(object sender, EventArgs e) { QRCoder.QRCodeGenerator QG = new QRCoder.QRCodeGenerator(); var MyData = QG.CreateQrCode(lblname.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(MyData); pictureBox2.Image = code.GetGraphic(50); }
private void btnQrCode_Click(object sender, EventArgs e) { if (txtSKU.TextLength > 0) { QRCoder.QRCodeGenerator qrGenerator = new QRCoder.QRCodeGenerator(); var qrData = qrGenerator.CreateQrCode(txtSKU.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var qrCode = new QRCoder.QRCode(qrData); var image = qrCode.GetGraphic(150); pictureBox1.Image = image; //Redimenciona a imagem para 200x200px image = ImageHelper.RedimensionarImagem(image, 200, 200); //Corta as bordas brancas da imagem, tamanho final fica em 160x160px image = ImageHelper.CropBitmap(image, 20, 20, 160, 160); var sb = new StringBuilder(); PrintDialog pd = new PrintDialog(); pd.PrinterSettings = new System.Drawing.Printing.PrinterSettings(); sb.AppendLine("I8,A,001"); sb.AppendLine("Q160,024"); sb.AppendLine("q831"); sb.AppendLine("rN"); sb.AppendLine("S4"); sb.AppendLine("D7"); sb.AppendLine("ZT"); sb.AppendLine("JF"); sb.AppendLine("OD"); sb.AppendLine("R283,0"); sb.AppendLine("f100"); sb.AppendLine("N"); //Converte bitmap para padrão .pcx que é o único formato de imagem suportado pela impressora sb.AppendLine(RawPrinterHelper.SendImageToPrinter(image, 30, 0)); sb.AppendLine("P1");//Comando de Impressão, Qty; //Verifica qual é a impressora padrão Selecionada FileHelper arquivo = new FileHelper(); string impressora = arquivo.Ler(); if (impressora != "Empty") { if (!RawPrinterHelper.SendStringToPrinter(impressora, sb.ToString())) { MessageBox.Show("Erro na impressão, favor verificar se a impressora esta configurada corretamente."); } } else { MessageBox.Show("Impressora de etiquetas padrão não foi definida, favor realizar a configuração!"); } } else { MessageBox.Show("Digite um código para gerar um QR Code."); } }
/// <summary> /// Рисует QR код /// </summary> /// <param name="data">данный</param> /// <param name="g">объект графики</param> /// <param name="z">размер квадрата</param> /// <param name="p">координаты левого верхнего угла</param> /// <param name="err_cor">уровень коррекции ошибок</param> public void DrawQrCode(string data, Graphics g, int z, PointF p, QRCoder.QRCodeGenerator.ECCLevel err_cor) { QRCoder.QRCodeData qr_data = qgen.CreateQrCode(data, err_cor); qrCode = new QRCoder.QRCode(qr_data); bitmap = qrCode.GetGraphic(10, Color.Black, Color.White, false); float h = z * (float)3.779527559055; g.DrawImage(bitmap, p.X, p.Y, h, h); }
public static Bitmap QRText(TextBox tb_onlyText) { QRCoder.QRCodeGenerator QG = new QRCoder.QRCodeGenerator(); var data = QG.CreateQrCode(tb_onlyText.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(data); Bitmap qrCodeImage = code.GetGraphic(50); return(qrCodeImage); }
/// <summary> /// 生成二维码 /// </summary> /// <param name="msg">信息</param> /// <param name="pixel">像素点大小</param> /// <returns>位图</returns> public static Bitmap GenQRCode(string msg, int pixel) { QRCoder.QRCodeGenerator code_generator = new QRCoder.QRCodeGenerator(); QRCoder.QRCodeData code_data = code_generator.CreateQrCode(msg, QRCoder.QRCodeGenerator.ECCLevel.M /* 这里设置容错率的一个级别 */); QRCoder.QRCode code = new QRCoder.QRCode(code_data); Bitmap bmp = code.GetGraphic(pixel, Color.Black, Color.White, drawQuietZones: true); return(bmp); }
/// <summary> /// 生成不带图标的二维码到指定的路径 /// </summary> /// <param name="msg">二维码内容</param> /// <param name="version">版本 1 ~ 40</param> /// <param name="pixel">像素点大小(二维码的大小)</param> /// <param name="white_edge">二维码白边</param> /// <param name="path">二维码存储路径</param> /// <param name="format">二维码图片格式(.Bmp .Png等)</param> public static void Code(string msg, int version, int pixel, bool white_edge, string path, ImageFormat format) { QRCoder.QRCodeGenerator code_generator = new QRCoder.QRCodeGenerator(); QRCoder.QRCodeData code_data = code_generator.CreateQrCode(msg, QRCoder.QRCodeGenerator.ECCLevel.M /* 这里设置容错率的一个级别 */, true, true, QRCoder.QRCodeGenerator.EciMode.Utf8, version); QRCoder.QRCode code = new QRCoder.QRCode(code_data); Bitmap bmp = code.GetGraphic(pixel, Color.Black, Color.White, null, 0, 0, white_edge); bmp.Save(path, format); }
/// <summary> /// 生成不带图标的二维码 /// </summary> /// <param name="msg">二维码内容</param> /// <param name="version">版本 1 ~ 40</param> /// <param name="pixel">像素点大小(二维码的大小)</param> /// <param name="white_edge">二维码白边</param> /// <returns></returns> public static Bitmap Code(string msg, int version, int pixel, bool white_edge) { QRCoder.QRCodeGenerator code_generator = new QRCoder.QRCodeGenerator(); QRCoder.QRCodeData code_data = code_generator.CreateQrCode(msg, QRCoder.QRCodeGenerator.ECCLevel.M /* 这里设置容错率的一个级别 */, true, true, QRCoder.QRCodeGenerator.EciMode.Utf8, version); QRCoder.QRCode code = new QRCoder.QRCode(code_data); Bitmap bmp = code.GetGraphic(pixel, Color.Black, Color.White, null, 0, 0, white_edge); return(bmp); }
public static System.Drawing.Bitmap GetQRCodeBitmap(string aUrl) { QRCoder.QRCodeGenerator qrGenerator = new QRCoder.QRCodeGenerator(); QRCoder.QRCodeData qrCodeData = qrGenerator.CreateQrCode(aUrl, QRCoder.QRCodeGenerator.ECCLevel.Q); QRCoder.QRCode qrCode = new QRCoder.QRCode(qrCodeData); System.Drawing.Bitmap qrCodeImage = qrCode.GetGraphic(10); return(qrCodeImage); }
private void button1_Click(object sender, EventArgs e) { QRCoder.QRCodeGenerator qrCode = new QRCoder.QRCodeGenerator(); var myData = qrCode.CreateQrCode(txtQRCode.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(myData); pictureBox1.Image = code.GetGraphic(50); btnSaveQRCode.Visible = true; }
public static Bitmap GetQrCodeBitMap(string content, int version, int pixel) { QRCoder.QRCodeGenerator coder = new QRCoder.QRCodeGenerator(); QRCoder.QRCodeData codeData = coder.CreateQrCode(content, QRCoder.QRCodeGenerator.ECCLevel.M, true, true); QRCoder.QRCode code = new QRCoder.QRCode(codeData); Bitmap bitMap = code.GetGraphic(pixel, Color.Black, Color.White, true); return(bitMap); }
private void pictureloader() { string qrinfo = "https://acafe24.herokuapp.com/"; QRCoder.QRCodeGenerator QG = new QRCoder.QRCodeGenerator(); var MyData = QG.CreateQrCode(qrinfo, QRCoder.QRCodeGenerator.ECCLevel.H); var code = new QRCoder.QRCode(MyData); qrpicturebox.Image = code.GetGraphic(50); }
private void btngera_Click(object sender, EventArgs e) { QRCoder.QRCodeGenerator QR = new QRCoder.QRCodeGenerator(); var DADO = QR.CreateQrCode(txtqr.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var GERA = new QRCoder.QRCode(DADO); pictureBox1.Image = GERA.GetGraphic(50); }
private void button1_Click(object sender, EventArgs e) {//eventos do botão gerar. QRCoder.QRCodeGenerator qrGenerator = new QRCoder.QRCodeGenerator(); var qrData = qrGenerator.CreateQrCode(textBox1QrText.Text, QRCoder.QRCodeGenerator.ECCLevel.H); var qrCode = new QRCoder.QRCode(qrData); var image = qrCode.GetGraphic(150); //imagem gerada. pictureBox1Qrc.Image = image; //colocando a imagem na caixa de imagens. button2SaveImage.Visible = true; //depois de gerada a imagem, definimos o botão salvar como visivel. File = pictureBox1Qrc.Image; //colocamos a imagem do qrcode em um arquivo do tipo Image. }