-1
我试图在C#中实现一个应用程序,该应用程序生成一个QR码。我设法做到了这一点,但我不知道如何在genButton_Click(object sender,EventArgs e)中调用CreateQRImage(string inputData)。调用事件处理函数内部的方法
我的窗内形成我有一个文本框和一个按钮,我认为功能CreateQRImage必须与文本
这里的名字被称为是代码:
private void genButton_Click(object sender, EventArgs e)
{
}
public void CreateQRImage(string inputData)
{
if (inputData.Trim() == String.Empty)
{
System.Windows.Forms.MessageBox.Show("Data must not be empty.");
}
BarcodeWriter qrcoder = new ZXing.BarcodeWriter
{
Format = BarcodeFormat.QR_CODE,
Options = new ZXing.QrCode.QrCodeEncodingOptions
{
ErrorCorrection = ZXing.QrCode.Internal.ErrorCorrectionLevel.H,
Height = 250,
Width = 250
}
};
string tempFileName = System.IO.Path.GetTempPath() + inputData + ".png";
Image image;
String data = inputData;
var result = qrcoder.Write(inputData);
image = new Bitmap(result);
image.Save(tempFileName);
System.Diagnostics.Process.Start(tempFileName);
}
this.CreateQRImage(“”);通过正确的inputData参数值 –
它问我为这个函数生成一个方法存根 – Valip