Barcode
TsgcHTMLComponent_Barcode — 从任意 ASCII 文本渲染纯 Pascal 实现的 Code 128 SVG 条形码,带有可选的人类可读说明文字,适用于 Delphi、C++ Builder 和 .NET。
TsgcHTMLComponent_Barcode — 从任意 ASCII 文本渲染纯 Pascal 实现的 Code 128 SVG 条形码,带有可选的人类可读说明文字,适用于 Delphi、C++ Builder 和 .NET。
设置 Data(可选设置 Symbology),然后读取 HTML 属性。
TsgcHTMLComponent_Barcode
内联 SVG Code 128 条形码 + 可选文字(纯 Pascal 编码器)
Delphi, C++ Builder, .NET
设置 Data,选择 ModuleWidth/Height,然后读取 HTML。
uses
sgcHTML_Component_Barcode;
var
oBarcode: TsgcHTMLComponent_Barcode;
begin
oBarcode := TsgcHTMLComponent_Barcode.Create(nil);
try
oBarcode.Data := 'ACME-00219841';
oBarcode.Symbology := bsCode128;
oBarcode.ModuleWidth := 2;
oBarcode.Height := 60;
oBarcode.ShowText := True;
WebModule.Response := oBarcode.HTML; // SVG bars + human-readable text
finally
oBarcode.Free;
end;
end;
// includes: sgcHTML_Component_Barcode.hpp
TsgcHTMLComponent_Barcode *oBarcode = new TsgcHTMLComponent_Barcode(NULL);
try
{
oBarcode->Data = "ACME-00219841";
oBarcode->Symbology = bsCode128;
oBarcode->ModuleWidth = 2;
oBarcode->Height = 60;
oBarcode->ShowText = true;
String html = oBarcode->HTML; // SVG bars + human-readable text
}
__finally
{
delete oBarcode;
}
using esegece.sgcWebSockets;
var barcode = new TsgcHTMLComponent_Barcode();
barcode.Data = "ACME-00219841";
barcode.Symbology = TsgcHTMLBarcodeSymbology.bsCode128;
barcode.ModuleWidth = 2;
barcode.Height = 60;
barcode.ShowText = true;
string html = barcode.HTML; // SVG bars + human-readable text
您最常使用的成员。
Data 是要编码的值;仅接受 ASCII 0–127(超出范围的字符会引发异常)。
Symbology 用于选择条形码标准;目前提供 Code 128(bsCode128),会在子集 A/B/C 之间自动切换以获得最紧凑的编码。
ModuleWidth 设置最窄条形的像素宽度;Height 设置条形高度。
ShowText 在条形下方打印编码后的 Data。
Color 为条形和文字上色;BackgroundColor 填充其背景。
GetSVG(HTML 也使用它)返回内联 SVG 标记,并包裹在 sgc-barcode 容器中。