I used SfBarcode to generate and display QRCode, but because the text used is too long, it generated memory overflow (2 GB or more).In the exception messages I discovered that the SfBarcode control uses the Syncfusion.Windows.Forms.Barcode.QRCode class; I removed the control and used the QRCode class directly.
Graphics in Windows have to be used with care, even more if you instantiate several objects to generate them and display them.
Here is an example:
using System;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Barcode;public Image QRCodeImagem(string textoqrc)
{
QRBarcode qrbc = new QRBarcode
{
ErrorCorrectionLevel = ErrorCorrectionLevel.Medium,
InputMode = QRInputMode.BinaryMode,
QRVersion = QRBarcodeVersion.Auto,
XDimension = 8
};
qrbc.Text = textoqrc;
return qrbc.Draw(0);
}
The Return as Image generated by the Draw () method, is perfect for inserting the QRCode image into any control as a PictureBox.