先谢谢大家,我急需一个条行码打印控件,是16位的数字。麻烦大家给介绍一个大家觉的比较好的控件。
还有一个问题要请教大家,是不是不同的扫描枪有不同的扫描标准呀,没有通用的吗?谢谢!

解决方案 »

  1.   


    bcCode128C,
    bcCode93,
    bcCode93Extended,
    bcCodeMSI,
    bcCodePostNet,
    bcCodeCodabar
    );
    TBarcode = class(TComponent)
    private
      { Private-Deklarationen }
    FHeight : integer;
    FText  : string;
    FTop    : integer;
    FLeft   : integer;
    FModul  : integer;
    FRatio  : double;
    FTyp    : TBarcodeType;
    FCheckSum:boolean;
    FShowText:boolean;
    FAngle  : double; modules:array[0..3] of shortint;
    procedure DoLines(data:string; Canvas:TCanvas); function Code_2_5_interleaved:string;
    function Code_2_5_industrial:string;
    function Code_2_5_matrix:string;
    function Code_39:string;
    function Code_39Extended:string;
    function Code_128:string;
    function Code_93:string;
    function Code_93Extended:string;
    function Code_MSI:string;
    function Code_PostNet:string;
    function Code_Codabar:string; function GetTypText:string;
    procedure MakeModules; procedure SetModul(v:integer); protected
      { Protected-Deklarationen }
    public
      { Public-Deklarationen }
    constructor Create(Owner:TComponent); override;
    procedure DrawBarcode(Canvas:TCanvas);
    procedure DrawText(Canvas:TCanvas);
    published
      { Published-Deklarationen }
    property Height : integer read FHeight write FHeight;
    property Text   : string  read FText   write FText;
    property Top    : integer read FTop    write FTop;
    property Left   : integer read FLeft   write FLeft;
    property Modul  : integer read FModul  write SetModul;
    property Ratio  : double  read FRatio  write FRatio;
    property Typ    : TBarcodeType read FTyp write FTyp default bcCode_2_5_interleaved;
    property Checksum:boolean read FCheckSum write FCheckSum default FALSE;
    property Angle  :double read FAngle write FAngle;
    property ShowText:boolean read FShowText write FShowText default FALSE;
    end;procedure Register;implementationfunction Convert(s:string):string;
    var
    i, v : integer;
    t : string;
    begin
    t := '';
    for i:=1 to Length(s) do
    begin
    v := ord(s[i]) - 1; if odd(i) then
    Inc(v, 5);
    t := t + Chr(v);
    end;
    Convert := t;
    end;function quersumme(x:integer):integer;
    var
    sum:integer;
    begin
    sum := 0; while x > 0 do
    begin
    sum := sum + (x mod 10);
    x := x div 10;
    end;
    result := sum;
    end;function Rotate2D(p:TPoint; alpha:double): TPoint;
    var
    sinus, cosinus : Extended;
    begin
    sinus   := sin(alpha);
    cosinus := cos(alpha);
    result.x := Round(p.x*cosinus + p.y*sinus);
    result.y := Round(-p.x*sinus + p.y*cosinus);
    end;function Translate2D(a, b:TPoint): TPoint;
    begin
    result.x := a.x + b.x;
    result.y := a.y + b.y;
    end;
    const tabelle_2_5:array['0'..'9', 1..5] of char =
    (
    ('0', '0', '1', '1', '0'),    // 0
    ('1', '0', '0', '0', '1'),    // 1
    ('0', '1', '0', '0', '1'),    // 2
    ('1', '1', '0', '0', '0'),    // 3
    ('0', '0', '1', '0', '1'),    // 4
    ('1', '0', '1', '0', '0'),    // 5
    ('0', '1', '1', '0', '0'),    // 6
    ('0', '0', '0', '1', '1'),    // 7
    ('1', '0', '0', '1', '0'),    // 8
    ('0', '1', '0', '1', '0')     // 9
    );constructor TBarcode.Create(Owner:TComponent);
    begin
    inherited Create(owner);
    FAngle := 0.0;
    FRatio := 2.0;
    FModul := 6;
    FTyp   := bcCode_2_5_interleaved;
    FCheckSum := FALSE;
    FShowText := FALSE;
    end;
    function TBarcode.GetTypText:string;const bcNames:array[bcCode_2_5_interleaved..bcCodeCodabar] of string =
    (
    ('2_5_interleaved'),
    ('2_5_industrial'),
    ('2_5_matrix'),
    ('Code39'),
    ('Code39 Extended'),
    ('Code128A'),
    ('Code128B'),
    ('Code128C'),
    ('Code93'),
    ('Code93 Extended'),
    ('MSI'),
    ('PostNet'),
    ('Codabar')
    );begin
    result := bcNames[FTyp];
    end;procedure TBarcode.SetModul(v:integer);
    begin
    if (v >= 1) and (v < 50) then
    FModul := v;
    end;function TBarcode.Code_2_5_interleaved:string;
    var
    i, j: integer;
    c : char;
    begin
    result := result + '5050';   // Startcode
    for i:=1 to Length(FText) div 2 do
    begin
              for j:= 1 to 5 do
              begin
                if tabelle_2_5[FText[i*2-1], j] = '1' then
                        c := '6'
                  else
                        c := '5';
                result := result + c;
                if tabelle_2_5[FText[i*2], j] = '1' then
                        c := '1'
                   else
                        c := '0';
                result := result + c;
              end;
    end; result := result + '605';    // Stopcode
    end;
    function TBarcode.Code_2_5_industrial:string;
    var i, j: integer;
    begin
    result := result + '606050';   // Startcode for i:=1 to Length(FText) do
    begin
    for j:= 1 to 5 do
    begin
    if tabelle_2_5[FText[i], j] = '1' then
    result := result + '60'
    else
    result := result + '50';
    end;
    end; result := result + '605060';   // Stopcode
    end;function TBarcode.Code_2_5_matrix:string;
    var
    i, j: integer;
    c :char;
    begin
    result := result + '705050';   // Startcode for i:=1 to Length(FText) do
    begin
    for j:= 1 to 5 do
    begin
    if tabelle_2_5[FText[i], j] = '1' then
    c := '1'
    else
    c := '0'; // Falls i ungerade ist dann mache L點ke zu Strich
    if odd(j) then
    c := chr(ord(c)+5);
    result := result + c;
    end;
    result := result + '0';   // L點ke zwischen den Zeichen
    end; result := result + '70505';   // Stopcode
    end;function TBarcode.Code_39:string;
    type TCode39 =
    record
    c : char;
    data : array[0..9] of char;
    chk: shortint;
    end;const tabelle_39: array[0..43] of TCode39 = (
    ( c:'0'; data:'505160605'; chk:0 ),
    ( c:'1'; data:'605150506'; chk:1 ),
    ( c:'2'; data:'506150506'; chk:2 ),
    ( c:'3'; data:'606150505'; chk:3 ),
    ( c:'4'; data:'505160506'; chk:4 ),
    ( c:'5'; data:'605160505'; chk:5 ),
    ( c:'6'; data:'506160505'; chk:6 ),
    ( c:'7'; data:'505150606'; chk:7 ),
    ( c:'8'; data:'605150605'; chk:8 ),
    ( c:'9'; data:'506150605'; chk:9 ),
    ( c:'A'; data:'605051506'; chk:10),
    ( c:'B'; data:'506051506'; chk:11),
    ( c:'C'; data:'606051505'; chk:12),
    ( c:'D'; data:'505061506'; chk:13),
    ( c:'E'; data:'605061505'; chk:14),
    ( c:'F'; data:'506061505'; chk:15),
    ( c:'G'; data:'505051606'; chk:16),
    ( c:'H'; data:'605051605'; chk:17),
    ( c:'I'; data:'506051600'; chk:18),
    ( c:'J'; data:'505061605'; chk:19),
    ( c:'K'; data:'605050516'; chk:20),
    ( c:'L'; data:'506050516'; chk:21),
    ( c:'M'; data:'606050515'; chk:22),
    ( c:'N'; data:'505060516'; chk:23),
    ( c:'O'; data:'605060515'; chk:24),
    ( c:'P'; data:'506060515'; chk:25),
    ( c:'Q'; data:'505050616'; chk:26),
    ( c:'R'; data:'605050615'; chk:27),
    ( c:'S'; data:'506050615'; chk:28),
    ( c:'T'; data:'505060615'; chk:29),
    ( c:'U'; data:'615050506'; chk:30),
    ( c:'V'; data:'516050506'; chk:31),
    ( c:'W'; data:'616050505'; chk:32),
    ( c:'X'; data:'515060506'; chk:33),
    ( c:'Y'; data:'615060505'; chk:34),
    ( c:'Z'; data:'516060505'; chk:35),
    ( c:'-'; data:'515050606'; chk:36),
    ( c:'.'; data:'615050605'; chk:37),
    ( c:' '; data:'516050605'; chk:38),
    ( c:'*'; data:'515060605'; chk:0 ),
    ( c:'$'; data:'515151505'; chk:39),
    ( c:'/'; data:'515150515'; chk:40),
    ( c:'+'; data:'515051515'; chk:41),
    ( c:'%'; data:'505151515'; chk:42)
    );
      

  2.   

    xfpjl(妖道) 你那个代码不全
    看我的你的快点下载
    http://qixin000.vicp.net/down/条码显示fbarcode.zip没准我什么时候就关掉了