使用asp.net C#生成qr代码(Web表单)

编程入门 行业动态 更新时间:2024-10-27 09:36:11
本文介绍了使用asp C#生成qr代码(Web表单)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

任何专家都可以帮忙吗?

受保护 void bn_create_Click( object sender,EventArgs e) { 字符串 url = tb_content.Text; QRCodeEncoder enc = new QRCodeEncoder(); Bitmap qrcode = enc.Encode(url); }

我可以使用Windows窗体,但不是Web窗体。因为网上没有图片框,任何人都可以帮我完成这些代码吗?我正在使用消息工具包。 如果你有任何其他想法/帮助它将拯救我的生命...

解决方案

请查看此视频。这对你有用。

查看这段代码片段。 它可以帮到你。

BarcodeLib.Barcode.QRCode barcode = new BarcodeLib.Barcode.QRCode(); barcode.Data = 123456789012; barcode.ModuleSize = 3 ; barcode.LeftMargin = 0 ; barcode.RightMargin = 0 ; barcode.TopMargin = 0 ; barcode.BottomMargin = 0 ; barcode.Encoding = BarcodeLib.Barcode.QRCodeEncoding.Auto; barcode.Version = BarcodeLib.Barcode.QRCodeVersion.V1; barcode.ECL = BarcodeLib.Barcode.QRCodeErrorCorrectionLevel.L; barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png; // 此处有更多条形码设置 // 将条形码图像保存到系统中 barcode.drawBarcode( c://barcode.png); // 生成条形码&输出到字节数组 byte [] barcodeInBytes = barcode.drawBarcodeAsBytes(); // 生成图形对象的条形码 图形图形= ...; barcode.drawBarcode(graphics); // 生成条形码并输出到HttpResponse对象 HttpResponse响应= ...; barcode.drawBarcode(response); // 生成条形码并输出到Stream对象 Stream stream = ...; barcode.drawBarcode(stream);

链接:www.barcodelib/net_barcode/barcode_symbologies/qrcode.html [ ^ ]

请参阅以下文章,其中讨论了如何在ASP中显示QR码。 NET。 http: //www.hanselman/blog/HowToDisplayAQRCodeInASPNETAndWPF.aspx [ ^ ]

can any experts help?

protected void bn_create_Click(object sender, EventArgs e) { string url = tb_content.Text; QRCodeEncoder enc = new QRCodeEncoder(); Bitmap qrcode = enc.Encode(url); }

I could make this work with windows form, but not web form. because there is no picture box on web, can anyone help me finish this codes? im using the messaging tool kit. if u have any other ideas/help it will save my life pls...

解决方案

Please take a look this video. This would be useful to you.

Check this code snippet.. It may help you.

BarcodeLib.Barcode.QRCode barcode = new BarcodeLib.Barcode.QRCode(); barcode.Data = "123456789012"; barcode.ModuleSize = 3; barcode.LeftMargin = 0; barcode.RightMargin = 0; barcode.TopMargin = 0; barcode.BottomMargin = 0; barcode.Encoding = BarcodeLib.Barcode.QRCodeEncoding.Auto; barcode.Version = BarcodeLib.Barcode.QRCodeVersion.V1; barcode.ECL = BarcodeLib.Barcode.QRCodeErrorCorrectionLevel.L; barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png; // more barcode settings here // save barcode image into your system barcode.drawBarcode("c://barcode.png"); // generate barcode & output to byte array byte[] barcodeInBytes = barcode.drawBarcodeAsBytes(); // generate barcode to Graphics object Graphics graphics = ...; barcode.drawBarcode(graphics); // generate barcode and output to HttpResponse object HttpResponse response = ...; barcode.drawBarcode(response); // generate barcode and output to Stream object Stream stream = ...; barcode.drawBarcode(stream);

Link : www.barcodelib/net_barcode/barcode_symbologies/qrcode.html[^]

Please refer below article which talks about how to display a QR code in ASP.NET . www.hanselman/blog/HowToDisplayAQRCodeInASPNETAndWPF.aspx[^]

更多推荐

使用asp.net C#生成qr代码(Web表单)

本文发布于:2023-11-15 21:45:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1598224.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   代码   net   asp   Web

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!