gpt4 book ai didi

c# - 如何在 UWP 应用程序中生成二维码?

转载 作者:行者123 更新时间:2023-11-30 20:19:54 24 4
gpt4 key购买 nike

我尝试为 UWP 应用程序安装 QrCode.net nugget 包,但它为我写了错误:

using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;

不是不存在。

有谁知道 UWP 应用程序的任何 nugget 包可以帮助我创建和显示从字符串生成的 QR 码? (UWP/C#)

最佳答案

Does anyone know any nugget package for UWP application that helps me to create and show a QR code that generated from a string? (UWP/C#)

由于您正在开发 UWP 应用,因此可以使用 Zxing.Net.Mobile包裹。安装此包后,生成条码,可引用如下示例:

<Image x:Name="qrcodeImg" Stretch="None" />

代码隐藏:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
var write = new BarcodeWriter();
write.Format = ZXing.BarcodeFormat.QR_CODE;
var wb = write.Write("BarCode Content");
this.qrcodeImg.Source = wb;
}

关于c# - 如何在 UWP 应用程序中生成二维码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37796416/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com