.net core里用ZXing生成二维码
2021-06-15 15:04
标签:sharp html csharp static enc 技术分享 sla write 获取 先获取Nuget包 .net core里用ZXing生成二维码 标签:sharp html csharp static enc 技术分享 sla write 获取 原文地址:http://www.cnblogs.com/IWings/p/7274989.html static void Main(string[] args)
{
string content = "二维码信息";
BitMatrix byteMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, 300, 300);
System.Drawing.Bitmap bitmap = toBitmap(byteMatrix);
}
public static System.Drawing.Bitmap toBitmap(BitMatrix matrix)
{
int width = matrix.Width;
int height = matrix.Height;
var white = System.Drawing.ColorTranslator.FromHtml("0xFFFFFFFF");
var black = System.Drawing.ColorTranslator.FromHtml("0xFF000000");
System.Drawing.Bitmap bmap = new System.Drawing.Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
for (int x = 0; x