【C#/WPF】.Net生成二维码QRCode的工具

2017-03-27 by qq_18995513

先马 http://qrcodenet.codeplex.com/

使用该工具WPF生成二维码的简单例子:

前台XAML准备一个Image控件显示二维码。

string qrcodeStr = "www.baidu.com";QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H);QrCode qrCode = new QrCode();QuietZoneModules QuietZones = QuietZoneModules.Two;qrEncoder.TryEncode(qrcodeStr, out qrCode);var render = new GraphicsRenderer(new FixedModuleSize(2, QuietZones));var ms = new MemoryStream();render.WriteToStream(qrCode.Matrix, System.Drawing.Imaging.ImageFormat.Png, ms);ImageSourceConverter imageSourceConverter = new ImageSourceConverter();yourImage.Source = (ImageSource)imageSourceConverter.ConvertFrom(ms);

第七城市

栏目导航(关闭)