Barcode 组件 — sgcHTML | eSeGeCe

Barcode

TsgcHTMLComponent_Barcode — 从任意 ASCII 文本渲染纯 Pascal 实现的 Code 128 SVG 条形码,带有可选的人类可读说明文字,适用于 Delphi、C++ Builder 和 .NET。

TsgcHTMLComponent_Barcode

设置 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 填充其背景。

渲染

GetSVGHTML 也使用它)返回内联 SVG 标记,并包裹在 sgc-barcode 容器中。

继续探索

在线帮助此组件的完整 API 参考和使用指南。
所有 sgcHTML 组件浏览 80 多个组件的完整功能矩阵。
下载免费试用版30 天试用版附带 60.HTML 演示项目。
价格Single、Team 和 Site 授权,均含完整源代码。

准备好开始了吗?

下载免费试用版,开始在 Delphi、C++ Builder 和 .NET 中构建 Web 界面。