如何使用 C# 生成 QR 碼

C# QR Code Generator

This article was translated from English: Does it need improvement?
Translated
View the article in English

IronQR is a world-class QR generator, detection model, and reader for .NET Developers. In the modern digital world, QR codes have become a common way to access information and connect with various services. Whether you want to create QR codes for your projects or decode them to gather data, IronQR is the ideal library for your needs in "C# QR Code Generation" and "C# QR Code Reading."

Welcome to our easy-to-follow tutorial on IronQR. We'll explore how to use this library to generate and read QR codes in C# programming, even if you're not an expert.

Get started with IronQR

立即開始在您的項目中使用 IronQR 並免費試用。

第一步:
green arrow pointer


Installation Options

Unlock the potential of seamless QR code generation and reading in your C# projects with IronQR's powerful NuGet package. Whether you're a seasoned developer or just starting your coding journey, our library simplifies the process, making it accessible to everyone. With IronQR, you can effortlessly generate custom QR codes and decode them with ease. Don't miss out on this opportunity to supercharge your applications. Follow the link to download our NuGet package and open the door to a world of QR code possibilities with IronQR today!

Generating and Reading QR Codes

In this combined chapter, you'll learn about creating and decoding QR codes using IronQR. We'll cover the setup and implementation, making it easy for you to generate QR codes that suit your needs and decode QR codes to extract and use the information they hold.

QR Code Generation Made Simple with IronQR

QR codes have become an essential tool for businesses and developers to bridge the physical and digital worlds. With IronQR, the process of creating and working with QR codes in your C# applications has never been easier. The following code example demonstrates how you can effortlessly generate a QR code from a text string and save it as an image file. IronQR simplifies the complexity of QR code handling, making it accessible to developers of all levels. See how you can unlock the power of IronQR in your projects and take your applications to the next level.

:path=/static-assets/qr/content-code-examples/get-started/get-started-1.cs
using IronQr;
using IronSoftware.Drawing;

// Create a QR Code object
QrCode myQr = QrWriter.Write("hello world");

// Save QR Code as a Bitmap
AnyBitmap qrImage = myQr.Save();

// Save QR Code Bitmap as File
qrImage.SaveAs("qr.png");
Imports IronQr
Imports IronSoftware.Drawing

' Create a QR Code object
Private myQr As QrCode = QrWriter.Write("hello world")

' Save QR Code as a Bitmap
Private qrImage As AnyBitmap = myQr.Save()

' Save QR Code Bitmap as File
qrImage.SaveAs("qr.png")
$vbLabelText   $csharpLabel

Simplified QR Code Reading with IronQR

QR codes are everywhere, and they often contain important information. With IronQR, you can easily decode QR codes in your C# applications. The following example shows how to read a QR code from an image file. IronQR makes QR code decoding straightforward, even for those new to programming. Just open an image, read the QR codes it contains, and access the information within them. Discover the simplicity of IronQR and enhance your projects with effortless QR code reading today.

:path=/static-assets/qr/content-code-examples/get-started/get-started-2.cs
using IronQr;
using IronSoftware.Drawing;
using System.Collections.Generic;

// Open the asset to read a QR Code from
var inputBmp = AnyBitmap.FromFile("IMAGE_TO_READ.png");

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

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

// Read the Input an get all embedded QR Codes
IEnumerable<QrResult> results = reader.Read(imageInput);
Imports IronQr
Imports IronSoftware.Drawing
Imports System.Collections.Generic

' Open the asset to read a QR Code from
Private inputBmp = AnyBitmap.FromFile("IMAGE_TO_READ.png")

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

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

' Read the Input an get all embedded QR Codes
Private results As IEnumerable(Of QrResult) = reader.Read(imageInput)
$vbLabelText   $csharpLabel

Conclusion

In this article, we've explored the dynamic capabilities of IronQR, the go-to library for "C# QR Code Generation" and "C# QR Code Reading." As our digital world continues to evolve, QR codes have become integral to various industries, offering a bridge between the physical and digital realms.

IronQR makes QR code generation and reading straightforward, ensuring that even beginners can quickly integrate QR code functionality into their C# applications. The code examples provided illustrate how you can generate QR codes from text and read QR codes from image files, all with minimal effort.

In conclusion, IronQR empowers you to unlock the full potential of QR codes in your applications. Its user-friendly approach, comprehensive documentation, and powerful features make it the perfect choice for anyone seeking to enhance their software with QR code functionality. Embrace the world of QR codes with IronQR, and discover how it can take your C# projects to new heights.

常見問題解答

我怎样才能在 C# 中生成 QR 码?

要在C#中生成QR碼,您可以使用IronQR的QRCodeWriter類。這樣您可以從文本字符串創建QR碼並將其保存為圖像文件,簡化了該過程,只需幾行代碼即可完成。

如何從C#的圖像文件中讀取QR碼?

IronQR的BarcodeReader類使您可以從圖像文件中讀取QR碼。您只需指定圖像文件路徑,使用Read方法解碼QR碼,並訪問其中包含的信息。

在C#中QR碼庫的安裝選項有哪些?

IronQR作為NuGet包提供,這簡化了安裝和集成到您的C#項目中,提供無縫的QR碼生成和讀取功能。

我可以在C#中生成的QR碼中添加標誌嗎?

是的,您可以使用IronQR在C#生成的QR碼中添加標誌。此功能增強了QR碼的外觀和品牌效應。

QR碼如何造福於企業和開發人員?

QR碼在實體和數位世界之間架起了橋樑,為企業和開發人員提供了一種多功能的工具,用於信息共享、鏈接到數字內容並增強用戶參與度。

IronQR適合C#編程初學者嗎?

是的,IronQR旨在對所有級別的開發人員,包括初學者在內使用友好且易於獲得。它提供詳盡的文件和易於遵循的教程。

哪些編程環境支持QR碼庫?

IronQR 支援 .NET 10、9、8、7、6、Core 和 Framework,使其對各種 C# 開發環境具有多功能性。

我如何在C#中從文檔中解碼QR碼?

使用IronQR,您可以通過閱讀包含QR碼的文檔內的圖像文件來解碼QR碼。BarcodeReader類促成了這個過程,通過提取和解碼QR碼信息。

在應用程式中使用IronQR的主要好處是什麼?

IronQR提供強大的QR碼生成和讀取功能,簡化了將QR碼功能整合到應用程式中的過程。其用戶友好的界面和詳盡的文件使其成為增強軟體項目的有力工具。

我如何在C#中生成自定義QR碼?

借助IronQR,您可以通過指定內容和外觀屬性(如大小和顏色)來生成自定義QR碼。此自定義使您能夠創建滿足特定需求的QR碼。

Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
Nuget 下載 47,669 | 版本: 2025.11 剛剛發布