IRONSOFTWAREHOME
创建二维码
using IronBarCode;

// The value of the QR code as a string. Also suitable for URLS
string value = "https://ironsoftware.com/";

// Simplest example of creating a QR Code with no settings
GeneratedBarcode myQRCode = QRCodeWriter.CreateQrCode(value);

// Advanced example with all parameters exclusive to QR codes set:

// The error correction level of the QR code
var correction = QRCodeWriter.QrErrorCorrectionLevel.Highest;

// The width and height of the QR code in pixels
int size = 500;

// QR version.
// Please read https://www.qrcode.com/en/about/version.html to learn more about what QR version is
int qrVersion = 0;

GeneratedBarcode myQRCodeComplex = QRCodeWriter.CreateQrCode(value, size, correction, qrVersion);
Imports IronBarCode

' The value of the QR code as a string. Also suitable for URLS
Dim value As String = "https://ironsoftware.com/"

' Simplest example of creating a QR Code with no settings
Dim myQRCode As GeneratedBarcode = QRCodeWriter.CreateQrCode(value)

' Advanced example with all parameters exclusive to QR codes set:

' The error correction level of the QR code
Dim correction = QRCodeWriter.QrErrorCorrectionLevel.Highest

' The width and height of the QR code in pixels
Dim size As Integer = 500

' QR version.
' Please read https://www.qrcode.com/en/about/version.html to learn more about what QR version is
Dim qrVersion As Integer = 0

Dim myQRCodeComplex As GeneratedBarcode = QRCodeWriter.CreateQrCode(value, size, correction, qrVersion)
NuGet Download
PM > Install-Package BarCode
创建二维码

创建二维码

IronBarcode 为开发者提供直观易用的方法,创建具有大量自定义选项的独特二维码。 无论您是正在寻找只需几行代码即可生成简单二维码的开发人员,还是正在寻找可以控制二维码所有方面(例如纠错级别、大小和版本)的更复杂的生成器的开发人员,IronBarcode 都能在一个库中提供您所需的一切。

在导入QRCodeWriter.CreateQrCode创建一个包含URL字符串值的新二维码。 这是使用默认设置创建二维码的最简单方法。

我们可以调整二维码的errorCorrectionLevel以实现更多自定义。 该级别与二维码中包含的冗余或错误恢复数据量相关,使其更具容错性,并确保其在恶劣条件下也能正常工作。

为了控制size,只需为其分配一个整数值。 qrVersion(介于1到40之间)表示二维码版本。 根据您希望存储的数据量和您希望二维码具有的容量,开发人员可以对其进行微调,以在容量和大小之间取得平衡,从而确保优化。 有关如何确定二维码版本的更多信息,请参阅此处的文档。

最后,我们再次将所有已建立的变量QRCodeWriter.CreateQrCode方法,以生成一个具有上述所有属性的自定义二维码。

探索如何创建自定义条形码图像
在 GitHub 上查看

准备开始了吗?

Nuget Downloads 2,422,100版本: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 天试用密钥
无需信用卡或创建账户