Enter description 我正在尝试为用户开发WindowsForm应用程序,以扫描和读取QR码以循环到下一页。但是我遇到了一个问题,我的代码是让用户在文本框中键入他们的主题以生成它。如何更改代码,让用户在文本框中输入研究内容以生成代码,从而使用zxing.net在asp.net中自动生成QR码
下面是我的代码示例。
protected void btnQCGenerate_Click(object sender, EventArgs e)
{
GenerateMyQCCode(txtQCCode.Text);
}
protected void btnQCRead_Click(object sender, EventArgs e)
{
ReadQRCode();
}
private void GenerateMyQCCode(string QCText)
{
var QCwriter = new BarcodeWriter();
QCwriter.Format = BarcodeFormat.QR_CODE;
var result = QCwriter.Write(QCText);
string path = Server.MapPath("~/images/MyQRImage.jpg");
var barcodeBitmap = new Bitmap(result);
using (MemoryStream memory = new MemoryStream())
{
using (FileStream fs = new FileStream(path,
FileMode.Create, FileAccess.ReadWrite))
{
barcodeBitmap.Save(memory, ImageFormat.Jpeg);
byte[] bytes = memory.ToArray();
fs.Write(bytes, 0, bytes.Length);
}
}
imgageQRCode.Visible = true;
imgageQRCode.ImageUrl = "~/images/MyQRImage.jpg";
}