获取错误生成qr代码时参数无效

时间:2018-04-20 19:50:46

标签: c# .net qr-code

尝试将数据从文本框写入qr代码

时收到此错误消息
QRCoder.QRCodeGenerator qrgen = new QRCoder.QRCodeGenerator();
        string str4 = textBox1.Text.ToString();
        var qrdata = qrgen.CreateQrCode(str4, QRCoder.QRCodeGenerator.ECCLevel.H);

        var qrcode = new QRCoder.QRCode(qrdata);
        //QRCoder.QRCodeData.
        //Bitmap bmp = new Bitmap(qrcode.GetGraphic(150));
        var image = qrcode.GetGraphic(150);
        pictureBox1.Image = image;

        string str3 = textBox2.Text + "QR";
        string armyno1 = str3 + ".jpg";
        string path1 = @"c:\AFMSF21\";
        string fullpath = System.IO.Path.Combine(path1, armyno1);
        pictureBox1.Image.Save(fullpath);

1 个答案:

答案 0 :(得分:0)

谢谢Aaron这个改变很好......  var image = qrcode.GetGraphic(50);