添加引用:using Gma.QrCodeNet.Encoding.Windows.Render;using Gma.QrCodeNet.Encoding;引用Gma.QrCodeNet.Encoding.dll文件string helloWorld = "helloWorld"; QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H); QrCode qrCode = new QrCode(); qrEncoder.TryEncode(helloWorld, out qrCode); GraphicsRenderer renderer = new GraphicsRenderer(new FixedModuleSize(12, QuietZoneModules.Two)); MemoryStream ms = new MemoryStream(); using (FileStream stream = new FileStream(@"C:/Users/Administrator/Desktop/新建文件夹/HelloWorld.png", FileMode.Create)) { //ImageFormat.Png和BMP两种格式不会有黑边框 renderer.WriteToStream(qrCode.Matrix, ImageFormat.Png, stream); }
新闻热点
疑难解答