IRONSOFTWAREHOME
.NET MAUI QR码扫描器
using IronQr;
using IronSoftware.Drawing;

// OnScanButtonClicked method triggered by the scan button
private async void OnScanButtonClicked(object sender, EventArgs e)
{
    // Open the device image picker
    var images = await FilePicker.Default.PickAsync(new PickOptions
    {
        PickerTitle = "Pick image",
        FileTypes = FilePickerFileType.Images
    });
    var imageSource = images.FullPath.ToString();

    // Load the selected image into AnyBitmap
    var inputBmp = AnyBitmap.FromFile(imageSource);

    // Load the asset into QrImageInput
    QrImageInput imageInput = new QrImageInput(inputBmp);

    // Create a QR Reader object
    QrReader reader = new QrReader();

    // Read the input and get all embedded QR Codes
    IEnumerable<QrResult> results = reader.Read(imageInput);

    // Display the first result
    resultLabel.Text = "Scanned Text: " + results.First().Value;
}
Imports IronQr
Imports IronSoftware.Drawing

' OnScanButtonClicked method triggered by the scan button
Private Async Sub OnScanButtonClicked(ByVal sender As Object, ByVal e As EventArgs)
    ' Open the device image picker
    Dim images = Await FilePicker.Default.PickAsync(New PickOptions With {
        .PickerTitle = "Pick image",
        .FileTypes = FilePickerFileType.Images
    })
    Dim imageSource = images.FullPath.ToString()

    ' Load the selected image into AnyBitmap
    Dim inputBmp = AnyBitmap.FromFile(imageSource)

    ' Load the asset into QrImageInput
    Dim imageInput As New QrImageInput(inputBmp)

    ' Create a QR Reader object
    Dim reader As New QrReader()

    ' Read the input and get all embedded QR Codes
    Dim results As IEnumerable(Of QrResult) = reader.Read(imageInput)

    ' Display the first result
    resultLabel.Text = "Scanned Text: " & results.First().Value
End Sub
NuGet Download
PM > Install-Package IronQR
.NET MAUI QR码扫描器

.NET MAUI QR码扫描器

using IronQR 在 .NET MAUI 移动应用中扫描二维码。 使用QrReader.Read解码。 在 Android 和 iOS 系统上通过单一共享代码库工作。

构建 MAUI QR 码扫描器的 5 步指南

  • using IronQr;
  • using IronSoftware.Drawing;
  • var images = await FilePicker.Default.PickAsync(new PickOptions { FileTypes = FilePickerFileType.Images });
  • var inputBmp = AnyBitmap.FromFile(images.FullPath.ToString();
  • IEnumerable<QrResult> results = reader.Read(imageInput);

代码解释

AnyBitmap.FromFile,无论格式如何都将其加载到位图中。 一个IEnumerable<QrResult>First().Value从第一个结果中提取解码的字符串。

使用 IronQR 探索完整的 .NET MAUI QR 码扫描器教程。

准备开始了吗?

Nuget Downloads 74,386版本:2026.9刚刚发布

Key in blue circle

立即获取免费的 30 天试用版密钥

Your trial license will be sent to your email address

无任何限制。100% 解锁。无需信用卡。

bullet_checked无需信用卡或创建账户无任何限制。100% 解锁。无需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
预约您的免费现场演示
Booking Badge

深受全球数百万工程师信赖

Iron Software 的客户徽标
获取您的无义务咨询
填写下面的表格或通过sales@ironsoftware.com
您的资料将始终保密。
深受全球数百万工程师信赖
Iron Software 的客户徽标
立即获取您的免费30 天试用密钥
无需信用卡或创建账户