QR码输入密钥C#

时间:2016-07-21 08:44:55

标签: c# qr-code

我正在尝试开发一个自动生成qr代码的程序。如何在我的代码中插入“输入密钥”?

谢谢!

以下是我生成二维码的方法:

string text_to_encode = "it"  + "\t " + "works" + "Enter here" + "done";
QRCodeEncoder encoder = new QRCodeEncoder();
encoder.QRCodeScale = 5;
encoder.QRCodeVersion = 2;
Bitmap img = encoder.Encode(text_to_encode);

img.Save(Directory.GetCurrentDirectory() + "\\qrcodes\\" + "qrcode" + ".png", System.Drawing.Imaging.ImageFormat.Png);

1 个答案:

答案 0 :(得分:0)

换行符(输入键)可以编码为"\r\n"或仅"\n",或者您可以使用System.Environment.NewLine

string text_to_encode = "it"  + "\t " + "works" + "\r\n" + "done";


string text_to_encode = "it"  + "\t " + "works" + System.Environment.NewLine + "done";