【问题标题】:Generate QRcode in a picturebox在图片框中生成二维码
【发布时间】:2015-02-06 03:13:41
【问题描述】:

我正在尝试在 Windows 窗体上生成 QR 码并尝试将其设置为图像框。 我从this 源获得以下代码,从here 获得相关文件。

            private void GenerateQrcode(string _data, string _filename)
    {
        QRCode qrcode = new QRCode();
        qrcode.Data = _data;
        qrcode.DataMode = QRCodeDataMode.Byte;
        qrcode.UOM = UnitOfMeasure.PIXEL;
        qrcode.X = 3;
        qrcode.LeftMargin = 0;
        qrcode.RightMargin = 0;
        qrcode.TopMargin = 0;
        qrcode.BottomMargin = 0;
        qrcode.Resolution = 72;
        qrcode.Rotate = Rotate.Rotate0;
        qrcode.ImageFormat = ImageFormat.Gif;
        qrcode.drawBarcode(_filename);
    }

我想知道这个文件是在哪里创建的。我必须作为文件名传递什么,只是一个字符串作为名称或正在创建文件的目录的路径。 如何在图片框中显示创建的文件?像这样?

       pictureBox1.Image = image;

【问题讨论】:

    标签: c# winforms picturebox qr-code


    【解决方案1】:

    http://www.onbarcode.com/csharp/qr-code-generator.html 上的例子说:

    // Generate QR-Code and encode barcode to gif format
    qrcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif;
    qrcode.drawBarcode("C:\\qrcode.gif"); 
    /*
    You can also call other drawing methods to generate barcodes          
    public void drawBarcode(Graphics graphics);
    public void drawBarcode(string filename);    
    public Bitmap drawBarcode();
    public void drawBarcode(Stream stream);             
    */
    

    【讨论】:

      猜你喜欢
      • 2020-02-03
      • 2016-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多