You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
896 B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QRCoder;
namespace Barcoded.qr
{
public class qrcode
{
string qrtype { get; set; }
string text { get; set; }
public qrcode(string type, string text)
{
this.qrtype = type;
this.text = text;
}
public System.Drawing.Image RenderCode()
{
string level = qrtype;
QRCodeGenerator.ECCLevel eccLevel = (QRCodeGenerator.ECCLevel)(level == "L" ? 0 : level == "M" ? 1 : level == "Q" ? 2 : 3);
using (QRCodeGenerator qrGenerator = new QRCodeGenerator())
using (QRCodeData qrCodeData = qrGenerator.CreateQrCode(text, eccLevel))
using (QRCode qrCode = new QRCode(qrCodeData))
return qrCode.GetGraphic(20);
}
}
}