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 碼掃描器

在.NET MAUI移動應用程式中使用IronQR掃描QR碼。 使用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);

程式碼說明

FilePicker.Default.PickAsync 打開當前平台上的原生圖片選擇器,僅過濾圖片型別。選定檔案的完整路徑可以用AnyBitmap.FromFile,不論格式如何都可以載入到位圖中。 QrImageInput 封裝該位圖,使IronQR能與之協作,並且QrReader.Read 返回IEnumerable<QrResult>First().Value 從第一個結果中提取解碼字串。

探索完整的.NET MAUI QR Code掃描器教程,使用IronQR。

準備好開始了嗎?

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天試用金鑰
無需信用卡或帳戶建立