Reputation: 784
I'm trying to generate a QR code on a windows form and trying to set it to an image box. I got the following code from this source and the related files from 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);
}
I want to know where this file is being created. What do I have to pass as file name, just a string as a name or the path of the directory which the file is being created. How can I display the created file in a picture box? like this?
pictureBox1.Image = image;
Upvotes: 0
Views: 2261
Reputation: 1419
The example on http://www.onbarcode.com/csharp/qr-code-generator.html says:
// 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);
*/
Upvotes: 1