QRCode
TsgcHTMLComponent_QRCode — 从任意文本或 URL 渲染纯 Pascal 实现的 ISO/IEC 18004 SVG 二维码,可选择纠错等级,适用于 Delphi、C++ Builder 和 .NET。
TsgcHTMLComponent_QRCode — 从任意文本或 URL 渲染纯 Pascal 实现的 ISO/IEC 18004 SVG 二维码,可选择纠错等级,适用于 Delphi、C++ Builder 和 .NET。
设置 Data 和 ECCLevel,然后读取 HTML 属性 — 或调用 Build 单行方法,一行代码即可完成。
TsgcHTMLComponent_QRCode
内联 SVG 二维码 + 可选说明文字(纯 Pascal 编码器)
Delphi, C++ Builder, .NET
设置 Data,选择 ECCLevel,然后读取 HTML — 或调用静态辅助方法 Build。
uses
sgcHTML_Component_QRCode;
var
oQR: TsgcHTMLComponent_QRCode;
sHTML: string;
begin
oQR := TsgcHTMLComponent_QRCode.Create(nil);
try
oQR.Data := 'https://www.esegece.com';
oQR.ECCLevel := qrHigh;
oQR.ModuleSize := 6;
oQR.Caption := 'Scan to open';
oQR.CaptionVisible := True;
WebModule.Response := oQR.HTML; // SVG QR modules + optional caption
finally
oQR.Free;
end;
end;
// One-liner for inline use inside a bigger page:
sHTML := TsgcHTMLComponent_QRCode.Build('https://www.esegece.com', qrHigh, 6);
// includes: sgcHTML_Component_QRCode.hpp
TsgcHTMLComponent_QRCode *oQR = new TsgcHTMLComponent_QRCode(NULL);
try
{
oQR->Data = "https://www.esegece.com";
oQR->ECCLevel = qrHigh;
oQR->ModuleSize = 6;
oQR->Caption = "Scan to open";
oQR->CaptionVisible = true;
String html = oQR->HTML; // SVG QR modules + optional caption
}
__finally
{
delete oQR;
}
using esegece.sgcWebSockets;
var qr = new TsgcHTMLComponent_QRCode();
qr.Data = "https://www.esegece.com";
qr.ECCLevel = TsgcHTMLQRECCLevel.qrHigh;
qr.ModuleSize = 6;
qr.Caption = "Scan to open";
qr.CaptionVisible = true;
string html = qr.HTML; // SVG QR modules + optional caption
您最常使用的成员。
Data 保存要编码的文本或 URL;编码器会自动选择数字、字母数字或字节模式,以及能容纳数据的最小版本(1–40)。
ECCLevel(qrLow/qrMedium/qrQuartile/qrHigh)在符号尺寸与抗损坏能力之间进行权衡。
ModuleSize 设置每个模块的像素大小;QuietZone 以模块为单位控制空白边框。
DarkColor/LightColor 用于重新设置模块和背景的颜色;请保持足够的对比度以确保可扫描。
Caption/CaptionVisible 在二维码下方渲染一行可选文字。
类函数 Build(aData, aECCLevel, aModuleSize) 无需管理实例即可返回可用的 HTML。